mirror of
https://github.com/php/php-src.git
synced 2024-11-27 20:03:40 +08:00
Revert "Fix parse_url(): can not recognize port without scheme"
This reverts commit 72d83709d9
.
Closes GH-9569
This commit is contained in:
parent
85d10cc93d
commit
2108d6983f
4
NEWS
4
NEWS
@ -22,6 +22,10 @@ PHP NEWS
|
||||
. Fixed GH-9584 (Avoid memory corruption when not unregistering custom session
|
||||
handler). (ilutov)
|
||||
|
||||
- Standard:
|
||||
. Revert "Fixed parse_url(): can not recognize port without scheme."
|
||||
(andypost)
|
||||
|
||||
15 Sep 2022, PHP 8.2.0RC2
|
||||
|
||||
- Core:
|
||||
|
@ -7,24 +7,42 @@ echo 'parse 127.0.0.1:9999?', PHP_EOL;
|
||||
var_dump(parse_url('127.0.0.1:9999?'));
|
||||
echo 'parse 127.0.0.1:9999#', PHP_EOL;
|
||||
var_dump(parse_url('127.0.0.1:9999#'));
|
||||
echo 'parse internal:#feeding', PHP_EOL;
|
||||
var_dump(parse_url('internal:#feeding'));
|
||||
echo 'parse magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C', PHP_EOL;
|
||||
var_dump(parse_url('magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C'));
|
||||
?>
|
||||
--EXPECT--
|
||||
*** Testing parse_url() :can not recognize port without scheme ***
|
||||
parse 127.0.0.1:9999?
|
||||
array(3) {
|
||||
["host"]=>
|
||||
["scheme"]=>
|
||||
string(9) "127.0.0.1"
|
||||
["port"]=>
|
||||
int(9999)
|
||||
["path"]=>
|
||||
string(4) "9999"
|
||||
["query"]=>
|
||||
string(0) ""
|
||||
}
|
||||
parse 127.0.0.1:9999#
|
||||
array(3) {
|
||||
["host"]=>
|
||||
["scheme"]=>
|
||||
string(9) "127.0.0.1"
|
||||
["port"]=>
|
||||
int(9999)
|
||||
["path"]=>
|
||||
string(4) "9999"
|
||||
["fragment"]=>
|
||||
string(0) ""
|
||||
}
|
||||
parse internal:#feeding
|
||||
array(2) {
|
||||
["scheme"]=>
|
||||
string(8) "internal"
|
||||
["fragment"]=>
|
||||
string(7) "feeding"
|
||||
}
|
||||
parse magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C
|
||||
array(2) {
|
||||
["scheme"]=>
|
||||
string(6) "magnet"
|
||||
["query"]=>
|
||||
string(44) "xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C"
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port
|
||||
p++;
|
||||
}
|
||||
|
||||
if ((p == ue || *p == '/' || *p == '?' || *p == '#') && (p - e) < 7) {
|
||||
if ((p == ue || *p == '/') && (p - e) < 7) {
|
||||
goto parse_port;
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port
|
||||
pp++;
|
||||
}
|
||||
|
||||
if (pp - p > 0 && pp - p < 6 && (pp == ue || *pp == '/' || *pp == '?' || *pp == '#')) {
|
||||
if (pp - p > 0 && pp - p < 6 && (pp == ue || *pp == '/')) {
|
||||
zend_long port;
|
||||
char *end;
|
||||
memcpy(port_buf, p, (pp - p));
|
||||
|
Loading…
Reference in New Issue
Block a user