mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02: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
3 changed files with 30 additions and 8 deletions
4
NEWS
4
NEWS
|
@ -22,6 +22,10 @@ PHP NEWS
|
||||||
. Fixed GH-9584 (Avoid memory corruption when not unregistering custom session
|
. Fixed GH-9584 (Avoid memory corruption when not unregistering custom session
|
||||||
handler). (ilutov)
|
handler). (ilutov)
|
||||||
|
|
||||||
|
- Standard:
|
||||||
|
. Revert "Fixed parse_url(): can not recognize port without scheme."
|
||||||
|
(andypost)
|
||||||
|
|
||||||
15 Sep 2022, PHP 8.2.0RC2
|
15 Sep 2022, PHP 8.2.0RC2
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
|
|
@ -7,24 +7,42 @@ echo 'parse 127.0.0.1:9999?', PHP_EOL;
|
||||||
var_dump(parse_url('127.0.0.1:9999?'));
|
var_dump(parse_url('127.0.0.1:9999?'));
|
||||||
echo 'parse 127.0.0.1:9999#', PHP_EOL;
|
echo 'parse 127.0.0.1:9999#', PHP_EOL;
|
||||||
var_dump(parse_url('127.0.0.1:9999#'));
|
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--
|
--EXPECT--
|
||||||
*** Testing parse_url() :can not recognize port without scheme ***
|
*** Testing parse_url() :can not recognize port without scheme ***
|
||||||
parse 127.0.0.1:9999?
|
parse 127.0.0.1:9999?
|
||||||
array(3) {
|
array(3) {
|
||||||
["host"]=>
|
["scheme"]=>
|
||||||
string(9) "127.0.0.1"
|
string(9) "127.0.0.1"
|
||||||
["port"]=>
|
["path"]=>
|
||||||
int(9999)
|
string(4) "9999"
|
||||||
["query"]=>
|
["query"]=>
|
||||||
string(0) ""
|
string(0) ""
|
||||||
}
|
}
|
||||||
parse 127.0.0.1:9999#
|
parse 127.0.0.1:9999#
|
||||||
array(3) {
|
array(3) {
|
||||||
["host"]=>
|
["scheme"]=>
|
||||||
string(9) "127.0.0.1"
|
string(9) "127.0.0.1"
|
||||||
["port"]=>
|
["path"]=>
|
||||||
int(9999)
|
string(4) "9999"
|
||||||
["fragment"]=>
|
["fragment"]=>
|
||||||
string(0) ""
|
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++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p == ue || *p == '/' || *p == '?' || *p == '#') && (p - e) < 7) {
|
if ((p == ue || *p == '/') && (p - e) < 7) {
|
||||||
goto parse_port;
|
goto parse_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port
|
||||||
pp++;
|
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;
|
zend_long port;
|
||||||
char *end;
|
char *end;
|
||||||
memcpy(port_buf, p, (pp - p));
|
memcpy(port_buf, p, (pp - p));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue