From: Ilia Alshanetsky Date: Sun, 12 Feb 2006 16:39:44 +0000 (+0000) Subject: Fixed bug #36351 (parse_url() does not parse numeric paths properly). X-Git-Tag: php-5.1.3RC1~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=535a2e6092d95e15a4d6cf420f8a629350ee4253;p=php Fixed bug #36351 (parse_url() does not parse numeric paths properly). --- diff --git a/NEWS b/NEWS index 7e35723b67..95d85cca84 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ PHP NEWS - Added imap_savebody() that allows message body to be written to a file. (Mike) - Fixed bug #36359 (splFileObject::fwrite() doesn't write when no data length specified). (Tony) +- Fixed bug #36351 (parse_url() does not parse numeric paths properly). (Ilia) - Fixed bug #36334 (Added missing documentation about realpath cache INI settings). (Ilia) - Fixed bug #36308 (ReflectionProperty::getDocComment() does not reflect diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt index be95e02949..2d18fa5c03 100644 --- a/ext/standard/tests/strings/url_t.phpt +++ b/ext/standard/tests/strings/url_t.phpt @@ -70,6 +70,7 @@ $sample_urls = array ( 'http://foo.com#bar', 'scheme:', 'foo+bar://baz@bang/bla', +'gg:9130731', ); foreach ($sample_urls as $url) { @@ -678,6 +679,12 @@ array(4) { ["path"]=> string(4) "/bla" } +array(2) { + ["scheme"]=> + string(2) "gg" + ["path"]=> + string(7) "9130731" +} string(4) "http" string(11) "www.php.net" int(80) diff --git a/ext/standard/url.c b/ext/standard/url.c index 43c47b38d9..d425e985c7 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -138,7 +138,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) p++; } - if ((*p) == '\0' || *p == '/') { + if ((*p == '\0' || *p == '/') && (p - e) < 7) { goto parse_port; }