From: Arnaud Le Blanc Date: Mon, 3 Nov 2008 15:47:05 +0000 (+0000) Subject: Fixed bug #43353 (wrong detection of 'data' wrapper causes notice) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0bed5602eece3cbe52306c32b3fa7e2d7833e00f;p=php Fixed bug #43353 (wrong detection of 'data' wrapper causes notice) --- diff --git a/ext/standard/tests/file/bug43353.phpt b/ext/standard/tests/file/bug43353.phpt new file mode 100644 index 0000000000..a11817895d --- /dev/null +++ b/ext/standard/tests/file/bug43353.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #43353 wrong detection of 'data' wrapper +--FILE-- + +--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) diff --git a/main/streams/streams.c b/main/streams/streams.c index a2cbe888bb..40989bbde8 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2076,7 +2076,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 */