diff options
author | Stanislav Malyshev <stas@php.net> | 2014-04-13 18:38:45 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2014-04-13 18:39:17 -0700 |
commit | 0d4c28f2e13fd6357bb10a263d0fa509811e8d03 (patch) | |
tree | da53a9df92226702e230f85e53d550dd71229bd8 | |
parent | 1ef0bd2633c981f538399f4ea22fb9429bcf50e0 (diff) | |
parent | 30ec1c005188e523eabc90741b3d8eda0cb81070 (diff) | |
download | php-git-0d4c28f2e13fd6357bb10a263d0fa509811e8d03.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
Fixed bug #64604
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/standard/tests/url/bug64604.phpt | 40 | ||||
-rw-r--r-- | ext/standard/url.c | 8 |
3 files changed, 46 insertions, 4 deletions
@@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2014, PHP 5.6.0 Beta 2 - Core: + . Fixed bug #64604 (parse_url is inconsistent with specified port). + (Ingo Walz) . Fixed bug #66015 (Unexpected array indexing in class's static property). (Bob) . Added (constant) string/array dereferencing to static scalar expressions to complete the set; now possible thanks to bug #66015 being fixed. (Bob) diff --git a/ext/standard/tests/url/bug64604.phpt b/ext/standard/tests/url/bug64604.phpt new file mode 100644 index 0000000000..bbc3cb9d1b --- /dev/null +++ b/ext/standard/tests/url/bug64604.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #64604 parse_url is inconsistent with specified port +--FILE-- +<?php +var_dump(parse_url('//localhost/path')); +var_dump(parse_url('//localhost:80/path')); +var_dump(parse_url('//localhost:/path')); +var_dump(parse_url('http://localhost:80/path')); +?> +--EXPECT-- +array(2) { + ["host"]=> + string(9) "localhost" + ["path"]=> + string(5) "/path" +} +array(3) { + ["host"]=> + string(9) "localhost" + ["port"]=> + int(80) + ["path"]=> + string(5) "/path" +} +array(2) { + ["host"]=> + string(9) "localhost" + ["path"]=> + string(5) "/path" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(9) "localhost" + ["port"]=> + int(80) + ["path"]=> + string(5) "/path" +} diff --git a/ext/standard/url.c b/ext/standard/url.c index d8271a18ed..16237e6599 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -181,6 +181,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) p = e + 1; pp = p; + if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + s += 2; + } + while (pp-p < 6 && isdigit(*pp)) { pp++; } @@ -201,10 +205,6 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) STR_FREE(ret->scheme); efree(ret); return NULL; - } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ - s += 2; - } else { - goto just_path; } } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ s += 2; |