|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80114 parse_url does not accept URLs with port 0
Submitted: 2020-09-17 01:52 UTC Modified: 2020-09-17 13:06 UTC
From: gtisza at gmail dot com Assigned: cmb (profile)
Status: Closed Package: *URL Functions
PHP Version: 7.3 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gtisza at gmail dot com
New email:
PHP Version: OS:


 [2020-09-17 01:52 UTC] gtisza at gmail dot com
parse_url fails to parse URLs with port 0 (like 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 ). At a minimum, if this is an intentional constraint, it should be documented.

Test case:
Affects all PHP versions starting with 5.3.6 (before it was parsed as expected).

See also #62159.

Test script:
var_dump( parse_url('') );

var_dump( parse_url('') );


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-17 12:58 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2020-09-17 13:05 UTC]
The following pull request has been associated:

Patch Name: Fix #80114: parse_url does not accept URLs with port 0
On GitHub:
 [2020-09-17 13:05 UTC]
-PHP Version: 8.0.0beta3 +PHP Version: 7.3
 [2020-09-17 13:06 UTC]
-Operating System: Linux +Operating System: *
 [2020-09-20 13:39 UTC]
Automatic comment on behalf of
Log: Fix #80114: parse_url does not accept URLs with port 0
 [2020-09-20 13:39 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 16:01:25 2023 UTC