[php-src] Issue #12703: Colon in url path is not parsed by `parse_url`
| From: | vdauchy | Date: | Fri, 17 Nov 2023 15:11:54 +0000 |
| Subject: | [php-src] Issue #12703: Colon in url path is not parsed by `parse_url` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245829@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12703
Author: vdauchy
### Description
The following code:
```php
<?php
var_dump(parse_url('/page:1?foo=bar')); // Working parsing of the path.
var_dump(parse_url('/page:1'));
var_dump(parse_url('/page:1', \PHP_URL_SCHEME));
```
Resulted in this output:
```
array(2) {
["path"]=>
string(7) "/page:1"
["query"]=>
string(7) "foo=bar"
}
bool(false)
bool(false)
```
But I expected this output instead:
```
array(2) {
["path"]=>
string(7) "/page:1"
["query"]=>
string(7) "foo=bar"
}
array(1) {
["path"]=>
string(7) "/page:1"
}
NULL
```
Note: Only absolute path stating by
/ shall be handled as path as .
This issue is opened following discussion on Symfony DomCrawler: https://github.com/symfony/symfony/issues/52628
### PHP Version
8.1.12
### Operating System
_No response_