From: Tjerk Meesters Date: Fri, 6 Mar 2015 12:59:52 +0000 (+0800) Subject: Merge branch 'PHP-5.6' X-Git-Tag: PRE_PHP7_NSAPI_REMOVAL~787 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1236a30746119c3c99754c6c639a134d0e6318d6;p=php Merge branch 'PHP-5.6' * PHP-5.6: Fixed bug #68917 (parse_url fails on some partial urls) Update test to run locally instead of remotely --- 1236a30746119c3c99754c6c639a134d0e6318d6 diff --cc NEWS index 81aa649452,d248f86483..d7ac6bfab2 --- a/NEWS +++ b/NEWS @@@ -20,6 -26,12 +20,7 @@@ . Fixed bug #68166 (Exception with invalid character causes segv). (Rasmus) . Fixed bug #69141 (Missing arguments in reflection info for some builtin functions). (kostyantyn dot lysyy at oracle dot com) - -- CGI: - . Fixed bug #69015 (php-cgi's getopt does not see $argv). (Laruence) - -- CLI: - . Fixed bug #67741 (auto_prepend_file messes up __LINE__). (Reeze Xia) ++ . Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai) - cURL: . Fixed bug #69088 (PHP_MINIT_FUNCTION does not fully initialize cURL on diff --cc ext/standard/url.c index deb1450ad2,2f56d3186d..b2ffa3750e --- a/ext/standard/url.c +++ b/ext/standard/url.c @@@ -186,22 -186,25 +186,25 @@@ PHPAPI php_url *php_url_parse_ex(char c } if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) { - long port; + zend_long port; memcpy(port_buf, p, (pp - p)); port_buf[pp - p] = '\0'; - port = strtol(port_buf, NULL, 10); + port = ZEND_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); + if (ret->scheme) efree(ret->scheme); efree(ret); return NULL; } } else if (p == pp && *pp == '\0') { - STR_FREE(ret->scheme); + if (ret->scheme) efree(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;