Skip to content

Commit

Permalink
MFH: Fixed bug #43353 (wrong detection of 'data' wrapper causes notice)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Nov 3, 2008
1 parent 378bd30 commit 77f82b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -28,6 +28,7 @@ PHP NEWS
- Fixed bug #43452 (strings containing a weekday, or a number plus weekday
behaved incorrect of the current day-of-week was the same as the one in the
phrase).(Derick)
- Fixed bug #43353 (wrong detection of 'data' wrapper causes notice). (Arnaud)
- Fixed bug #42855 (dns_get_record() doesn't return all text from TXT record).
(a dot u dot savchuk at gmail dot com)
- Fixed bug #42718 (FILTER_UNSAFE_RAW not applied when configured as default
Expand Down
18 changes: 18 additions & 0 deletions ext/standard/tests/file/bug43353.phpt
@@ -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)
2 changes: 1 addition & 1 deletion main/streams/streams.c
Expand Up @@ -1511,7 +1511,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 */
Expand Down

0 comments on commit 77f82b1

Please sign in to comment.