From: Ilia Alshanetsky Date: Tue, 31 Dec 2002 18:54:38 +0000 (+0000) Subject: MFH X-Git-Tag: PHP_4_3_before_13561_fix~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=525bb0ed7e273d031b1a6832865e96362a02090d;p=php MFH --- diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt index 78a6706f54..29ee7fb48e 100644 --- a/ext/standard/tests/strings/url_t.phpt +++ b/ext/standard/tests/strings/url_t.phpt @@ -64,7 +64,10 @@ $sample_urls = array ( 'mailto:me@mydomain.com', '/foo.php?a=b&c=d', 'foo.php?a=b&c=d', -'http://user:passwd@www.example.com:8080?bar=1&boom=0' +'http://user:passwd@www.example.com:8080?bar=1&boom=0', +'file:///path/to/file', +'file://path/to/file', +'file:/path/to/file' ); foreach ($sample_urls as $url) { @@ -616,3 +619,21 @@ array(6) { ["query"]=> string(12) "bar=1&boom=0" } +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(12) "path/to/file" +} +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} diff --git a/ext/standard/url.c b/ext/standard/url.c index 8752a6a201..99a6c5df60 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -124,6 +124,9 @@ PHPAPI php_url *php_url_parse(char *str) if (*(e+2) == '/') { s = e + 3; + if (!strncasecmp("file", ret->scheme, sizeof("file"))) { + goto nohost; + } } else { s = e + 1; if (!strncasecmp("file", ret->scheme, sizeof("file"))) {