From:             gk at gknw dot de
Operating system: NetWare
PHP version:      5.2.5
PHP Bug Type:     Streams related
Bug description:  wrong detection of 'data' wrapper causes notice

Description:
------------
On NetWare we have volume names similar to drive letters on Win32;
however the volume names are not just one char, but can be up to 16 chars,
so an valid absolute path can look like:
data1:/myfolder/otherfolder

Now if I use f.e. is_dir(data1:/myfolder/otherfolder) then I get:
Notice: is_file() [function.is-file]: Unable to find the wrapper "data1" -
did you forget to enable it when you configured PHP? in
data1:/web/project/tstpaths.php on line 13

It seems to me that the problem is in ./main/streams/streams.c at line
1519; I did modify this line as below, and the issue is then gone:

--- streams.c.orig      Wed Aug 08 08:01:50 2007
+++ streams.c   Tue Nov 20 23:45:45 2007
@@ -1516,7 +1516,7 @@
                n++;
        }
 
-       if ((*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data",
path, 4))) {
+       if ((*p == ':') && (n > 1) && (!strncmp("//", p+1, 2))) {
                protocol = path;
        } else if (n == 5 && strncasecmp(path, "zlib:", 5) == 0) {
                /* BC with older php scripts and zlib wrapper */

however I'm not sure if now the 'data' wrapper still works; but formerly
due to the '||' everything beginning with 'data' did match.
I cant see a reason why the test for 'data' has to be handled without
checking for '://', but then I'm not familar with the 'data' wrapper at
all.

Reproduce code:
---------------
<pre>
<?php
// Test for the 'data' wrapper bug.
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

$mydir = "data:/myfolder/another/folder";
echo "is_dir ( $mydir ) = " . (is_dir($mydir) ? "true" : "false") . "\n";

$mydir = "data1:/myfolder/another/folder";
echo "is_dir ( $mydir ) = " . (is_dir($mydir) ? "true" : "false") . "\n";

$mydir = "data2:/myfolder/another/folder";
echo "is_dir ( $mydir ) = " . (is_dir($mydir) ? "true" : "false") . "\n";

?>
<pre>


Expected result:
----------------
is_dir ( data:/myfolder/another/folder ) = false
is_dir ( data1:/myfolder/another/folder ) = false
is_dir ( data2:/myfolder/another/folder ) = false


Actual result:
--------------
is_dir ( data:/myfolder/another/folder ) = false
Notice: is_dir() [function.is-dir]: Unable to find the wrapper "data1" -
did you forget to enable it when you configured PHP? in
sys:/www/tstphp/temp/wrapper_bug.php on line 10
Notice: is_dir() [function.is-dir]: Unable to find the wrapper "data1" -
did you forget to enable it when you configured PHP? in
sys:/www/tstphp/temp/wrapper_bug.php on line 10
is_dir ( data1:/myfolder/another/folder ) = false
Notice: is_dir() [function.is-dir]: Unable to find the wrapper "data2" -
did you forget to enable it when you configured PHP? in
sys:/www/tstphp/temp/wrapper_bug.php on line 13
Notice: is_dir() [function.is-dir]: Unable to find the wrapper "data2" -
did you forget to enable it when you configured PHP? in
sys:/www/tstphp/temp/wrapper_bug.php on line 13
is_dir ( data2:/myfolder/another/folder ) = false


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

Reply via email to