Bug #80114 [PATCH]: parse_url does not accept URLs with port 0
Edit report at https://bugs.php.net/bug.php?id=80114&edit=1
ID: 80114
Patch added by: cmb@php.net
Reported by: gtisza at gmail dot com
Summary: parse_url does not accept URLs with port 0
Status: Verified
Type: Bug
Package: *URL Functions
Operating System: Linux
PHP Version: 8.0.0beta3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #80114: parse_url does not accept URLs with port 0
On GitHub: https://github.com/php/php-src/pull/6152
Patch: https://github.com/php/php-src/pull/6152.patch
Previous Comments:
------------------------------------------------------------------------
[2020-09-17 01:52:28] gtisza at gmail dot com
Description:
------------
parse_url fails to parse URLs with port 0 (like https://example.com:0/). While 0 is not a valid port, it is
possible to send requests to it, and URLs with a zero port can be used for all kinds of purposes (
the URI itself is valid per https://tools.ietf.org/html/rfc3986#section-3.2.3
). At a minimum, if this is an intentional constraint, it should be documented.
Test case: https://3v4l.org/36TqT
Affects all PHP versions starting with 5.3.6 (before it was parsed as expected).
See also #62159.
Test script:
---------------
var_dump( parse_url('https://example.com:1/')
);
var_dump( parse_url('https://example.com:0/')
);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80114&edit=1
Thread (4 messages)