com php-src: Fixed bug #68917 (parse_url fails on som e partial urls): NEWS ext/standard/tests/url/bug6 8917.phpt ext/standard/url.c

From: Date: Fri, 06 Mar 2015 12:51:22 +0000
Subject: com php-src: Fixed bug #68917 (parse_url fails on som e partial urls): NEWS ext/standard/tests/url/bug6 8917.phpt ext/standard/url.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85291@lists.php.net to get a copy of this message
Commit: d7fb52ea20aba5c9ef53dfa57af3b62717c9e9e5 Author: Tjerk Meesters <datibbaw@php.net> Fri, 6 Mar 2015 20:51:22 +0800 Parents: e892f5382f8b2c652932060f1bd345eee4e59b84 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d7fb52ea20aba5c9ef53dfa57af3b62717c9e9e5 Log: Fixed bug #68917 (parse_url fails on some partial urls) Bugs: https://bugs.php.net/68917 Changed paths: M NEWS A ext/standard/tests/url/bug68917.phpt M ext/standard/url.c Diff: diff --git a/NEWS b/NEWS index d326677..879ff28 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2015, PHP 5.5.24 +- Core: + . Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai) 19 Mar 2015, PHP 5..5.23 diff --git a/ext/standard/tests/url/bug68917.phpt b/ext/standard/tests/url/bug68917.phpt new file mode 100644 index 0000000..620c8f7 --- /dev/null +++ b/ext/standard/tests/url/bug68917.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #68917 (parse_url fails on some partial urls) +--FILE-- +<?php +print_r(parse_url('//example.org:81/hi?a=b#c=d')); +print_r(parse_url('//example.org/hi?a=b#c=d')); +?> +--EXPECT-- +Array +( + [host] => example.org + [port] => 81 + [path] => /hi + [query] => a=b + [fragment] => c=d +) +Array +( + [host] => example.org + [path] => /hi + [query] => a=b + [fragment] => c=d +) diff --git a/ext/standard/url.c b/ext/standard/url.c index 31b027a..2f56d31 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -192,6 +192,9 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) port = strtol(port_buf, NULL, 10); if (port > 0 && port <= 65535) { ret->port = (unsigned short) port; + if (*s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ + s += 2; + } } else { STR_FREE(ret->scheme); efree(ret); @@ -201,12 +204,12 @@ 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 */ + } else if (*s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ s += 2; } else { goto just_path; } - } else if (*s == '/' && *(s+1) == '/') { /* relative-scheme URL */ + } else if (*s == '/' && *(s + 1) == '/') { /* relative-scheme URL */ s += 2; } else { just_path:

« previous php.cvs (#85291) next »