From: Andrew Faulds Date: Sun, 19 Aug 2012 23:03:55 +0000 (+0100) Subject: bug #62844; relative URL schemes in parse_url() X-Git-Tag: php-5.4.7RC1~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=36b88d77f2a9d0ac74692a679f636ccb5d11589f;p=php bug #62844; relative URL schemes in parse_url() --- diff --git a/ext/standard/tests/url/parse_url_relative_scheme.phpt b/ext/standard/tests/url/parse_url_relative_scheme.phpt new file mode 100644 index 0000000000..7c8952db71 --- /dev/null +++ b/ext/standard/tests/url/parse_url_relative_scheme.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test parse_url() function: Checks relative URL schemes (e.g. "//example.com") +--FILE-- + + string(11) "example.org" +} + diff --git a/ext/standard/url.c b/ext/standard/url.c index 0555c7b65a..f1e48a1a5f 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -204,6 +204,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } else { goto just_path; } + } else if (*s == '/' && *(s+1) == '/') { /* same-scheme (relative) URL */ + s += 2; } else { just_path: ue = s + length;