From:             flconseil at yahoo dot fr
Operating system: Unix & Windows
PHP version:      5.1.4
PHP Bug Type:     Streams related
Bug description:  Cannot add a 'Stream wrapped' path to include path

Description:
------------
After having declared a new stream wrapper, I want to add a sub-path of
this stram wrapper to the include path. The set_onclude_path() works fine,
but, then, PHP does not use this path when searching a file through the
include path.

It seems annoying, but normal on Unix, as the path separator is ':'. But
it also fails on Windows, where the path separator is ';'.

It will be hard to maintain backward compatibility but, if dirname() is
able to work on these paths, I think that it should be possible to append
them to the include path.

One solution would be to consider the include path as an array, instead of
maintaining it as a string. The get_include_path() and set_include_path()
could be kept as compatibility functions, the php.ini file could be kept
the same, but there would be two new functions get_include_path_array()
and set_include_path_array() which would work with arrays and would be
compatible with stream wrapper paths. More important, the PHP engine would
only use the array internally and could find files in stream wrapped
pseudo-directories. The stream wrapper should be ready to support '/' and
'\' characters as directory separators, if they want to work on Windows
and Unix.


Reproduce code:
---------------
1. I register a stream wrapper for the 'phk' prefix

2. 'include('phk://example/ex.php');' works OK. My virtual file is
included.

3. I add this path to the include path :
set_include_path(get_include_path().PATH_SEPARATOR.'phk://example');

4. I try to 'include(ex.php)' without specifying the path, as it is in the
include path -> it fails.

Expected result:
----------------
file included

Actual result:
--------------
PHP Warning:  include(ex.php): failed to open stream: No such file or
directory in ... on line ...
PHP Warning:  include(): Failed opening 'ex.php' for inclusion
(include_path='/logi/http/php/lib/php:/logi/http/php/lib/adodb:phk://example')
in ... on line ...


-- 
Edit bug report at http://bugs.php.net/?id=38006&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38006&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38006&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38006&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38006&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38006&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38006&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38006&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38006&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38006&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38006&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38006&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38006&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38006&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38006&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38006&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38006&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38006&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38006&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38006&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38006&r=mysqlcfg

Reply via email to