From 6b7d77a7a026f8eb03881537d721ca66eaf54949 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 14 Nov 2002 13:40:14 +0000 Subject: [PATCH] Fixed bug #20420 and added partial urls to the test of the function. --- ext/standard/tests/strings/url_t.phpt | 18 ++++++++++++++++-- ext/standard/url.c | 5 ++--- 2 files changed, 18 insertions(+), 5 deletions(-) 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, '/'))) { -- 2.40.0