#43353 [Opn->Csd]: wrong detection of 'data' wrapper causes notice
ID: 43353
Updated by: lbarnaud@php.net
Reported By: gk at gknw dot de
-Status: Open
+Status: Closed
Bug Type: Streams related
Operating System: NetWare only
PHP Version: 5.2CVS-2008-11-01
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-11-02 11:53:12] gk at gknw dot de
Hi Jani,
it seems this bug is not yet fixed with recent snapshot from
01-Nov-2008; also I see no commit related to this issue:
http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?view=log
just use my sample - it works on every platform, no need to run it on
NetWare.
Günter.
------------------------------------------------------------------------
[2008-10-30 17:03:04] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2007-11-20 23:25:46] gk at gknw dot de
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 this bug report at http://bugs.php.net/?id=43353&edit=1
Thread (4 messages)