MFH: Fixed bug #43353 (wrong detection of 'data' wrapper causes notice)

This commit is contained in:
Arnaud Le Blanc 2008-11-03 15:47:31 +00:00
parent e0fededeba
commit 0a2bfc7968
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,18 @@
--TEST--
Bug #43353 wrong detection of 'data' wrapper
--FILE--
<?php
var_dump(is_dir('file:///datafoo:test'));
var_dump(is_dir('datafoo:test'));
var_dump(file_get_contents('data:text/plain,foo'));
var_dump(file_get_contents('datafoo:text/plain,foo'));
?>
--EXPECTF--
bool(false)
bool(false)
string(3) "foo"
Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
bool(false)

View File

@ -1521,7 +1521,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char
n++;
}
if ((*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || !memcmp("data", path, 4))) {
if ((*p == ':') && (n > 1) && (!strncmp("//", p+1, 2) || (n == 4 && !memcmp("data:", path, 5)))) {
protocol = path;
} else if (n == 5 && strncasecmp(path, "zlib:", 5) == 0) {
/* BC with older php scripts and zlib wrapper */