[php-src] Issue #7890: parse_url() and incorrect port definition
| From: | KapitanOczywisty | Date: | Fri, 07 Jan 2022 00:00:55 +0000 |
| Subject: | [php-src] Issue #7890: parse_url() and incorrect port definition | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238831@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7890
Comment Author: KapitanOczywisty
Before port you can have only double slash - if there is anything more - it's not a port. I
think it's still possible to write proper url parsing which can handle invalid urls, but it
cannot relay on
: as a major part, it should be some state-based algorithm. [NodeJS
implementation](https://github.com/nodejs/node/blob/f6e5050579d8d0ec7c68ed499dcc8701bd49c18a/src/node_url.cc#L815)
could probably parse invalid urls, but it's way more complex. Even league/uri package is
capable of parsing broken URLs. Maybe this is the place for replacement of parse_url
with object-based internal extension. new URL(...) with isValid etc, but
with performance of native modules.