From: Ilia Alshanetsky Date: Thu, 14 Nov 2002 13:44:24 +0000 (+0000) Subject: MFH (parse_url bug). X-Git-Tag: php-4.3.0RC1~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c60242c94424992e69911fc7c877b975dfc5fb54;p=php MFH (parse_url bug). --- diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt index fef91799e0..78cf2bbeeb 100644 --- a/ext/standard/tests/strings/url_t.phpt +++ b/ext/standard/tests/strings/url_t.phpt @@ -61,7 +61,9 @@ $sample_urls = array ( 'zlib:filename.txt', 'zlib:/path/to/my/file/file.txt', 'foo://foo@bar', -'mailto:me@mydomain.com' +'mailto:me@mydomain.com', +'/foo.php?a=b&c=d', +'foo.php?a=b&c=d' ); foreach ($sample_urls as $url) { @@ -181,7 +183,7 @@ array(3) { } array(1) { ["path"]=> - string(13) "www.php.net/?" + string(12) "www.php.net/" } array(3) { ["host"]=> @@ -587,3 +589,15 @@ array(2) { ["path"]=> string(15) "me@mydomain.com" } +array(2) { + ["path"]=> + string(8) "/foo.php" + ["query"]=> + string(7) "a=b&c=d" +} +array(2) { + ["path"]=> + string(7) "foo.php" + ["query"]=> + string(7) "a=b&c=d" +} diff --git a/ext/standard/url.c b/ext/standard/url.c index 781b0ca5b5..9c8ce60c14 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -153,9 +153,8 @@ PHPAPI php_url *php_url_parse(char *str) } } else { just_path: - ret->path = estrndup(s, length); - php_replace_controlchars(ret->path); - return ret; + ue = s + length; + goto nohost; } if (!(e = strchr(s, '/'))) {