php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43353 wrong detection of 'data' wrapper causes notice
Submitted: 2007-11-20 23:25 UTC Modified: 2008-11-03 16:06 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gk at gknw dot de
New email:
PHP Version: OS:

 

 [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 commitsRelated reports
 [2008-10-30 17:03 UTC] 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/


 [2008-11-02 11:53 UTC] 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-11-03 16:06 UTC] lbarnaud@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 20:01:27 2024 UTC