[php-src] Issue #8370: parse_url mistakes hostname with path
| From: | cmb69 | Date: | Thu, 14 Apr 2022 11:27:37 +0000 |
| Subject: | [php-src] Issue #8370: parse_url mistakes hostname with path | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240960@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8370
Comment Author: cmb69
From the [docs](https://www.php.net/parse_url):
> Partial and invalid URLs are also accepted, parse_url() tries its best to parse them correctly.
parse_url looks for a scheme, and if it is missing, it has support for scheme relative
URLs (e.g. "//www.j-p.pl"). But if the indicators (two slashes) are missing, the URL is
treated as path. Given that [long standing behavior](https://3v4l.org/TV5A6), we cannot treat it as
bug, since there may be a lot of code relying on it. IMO, WONTFIX; maybe clarifying the algorithm in
the docs might be useful.