[php-src] Issue #14411: parse_url() returns fragment as part of query if given in the wrong order
| From: | Sebbo94BY | Date: | Sat, 01 Jun 2024 14:31:55 +0000 |
| Subject: | [php-src] Issue #14411: parse_url() returns fragment as part of query if given in the wrong order | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247011@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14411
Author: Sebbo94BY
### Description
The following code:
```php
var_dump( parse_url("http://localhosts.localdomain:8080/index.php#some_fragment?key=value")
);
```
Resulted in this output:
```
array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
string(22) "localhosts.localdomain"
["port"]=>
int(8080)
["path"]=>
string(10) "/index.php"
["fragment"]=>
string(23) "some_fragment?key=value"
}
```
But I expected this output instead:
```
false (bool)
```
[RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) specifies that a fragment must be after
the query, so the above URL is invalid and should respectively return
false (boolean).
### PHP Version
PHP 8.3.8
### Operating System
_No response_