Bug #78997 [Opn]: PHP parse_url incorrect
| From: | cmb@php.net | Date: | Thu, 19 Dec 2019 11:17:02 +0000 |
| Subject: | Bug #78997 [Opn]: PHP parse_url incorrect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224406@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78997&edit=1
ID: 78997
Updated by: cmb@php.net
Reported by: dinhbaouit at gmail dot com
Summary: PHP parse_url incorrect
Status: Open
Type: Bug
-Package: *General Issues
+Package: *URL Functions
Operating System: ubuntu
PHP Version: 7.2.26
Block user comment: N
Private report: N
New Comment:
I can confirm this behavior[1], but like the documentation[2]
states:
| Partial URLs are also accepted, parse_url() tries its best to
| parse them correctly.
So, in my opinion, this is not a bug (and might be duplicate
anyway).
[1] <https://3v4l.org/h4EMu>
[2] <https://www.php.net/parse_url>
Previous Comments:
------------------------------------------------------------------------
[2019-12-19 09:51:15] dinhbaouit at gmail dot com
Description:
------------
In PHP <7.2.26 when using parse_url "host:port?query" the result return incorrect
Test script:
---------------
<?php
var_dump(parse_url("localhost:80?a=1"));
?>
Expected result:
----------------
php > var_dump(parse_url("localhost:80?a=1"));
array(3) {
["host"]=>
string(9) "localhost"
["port"]=>
string(2) "80"
["query"]=>
string(3) "a=1"
}
Actual result:
--------------
php > var_dump(parse_url("localhost:80?a=1"));
array(3) {
["scheme"]=>
string(9) "localhost"
["path"]=>
string(2) "80"
["query"]=>
string(3) "a=1"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78997&edit=1