wrong detection of 'data' wrapper causes notice
| Bug #43353 | wrong detection of 'data' wrapper causes notice | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2007-11-20 23:25 UTC | Modified: | 2008-11-03 16:06 UTC |
|
||||||||||
| From: | gk at gknw dot de | Assigned: | ||||||||||||
| Status: | Closed | Package: | Streams related | |||||||||||
| PHP Version: | 5.2CVS-2008-11-01 | OS: | NetWare only | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2007-11-20 23:25 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2008-11-03 16:06 UTC] lbarnaud@php.net