php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gtisza at gmail dot com
New email:
PHP Version: OS:

 

 [2020-09-17 01:52 UTC] 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/') );


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-17 12:58 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2020-09-17 13:05 UTC] cmb@php.net
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
 [2020-09-17 13:05 UTC] cmb@php.net
-PHP Version: 8.0.0beta3 +PHP Version: 7.3
 [2020-09-17 13:06 UTC] cmb@php.net
-Operating System: Linux +Operating System: *
 [2020-09-20 13:39 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=81b2f3e5d9fcdffd87a4fcd12bd8c708a97091e1
Log: Fix #80114: parse_url does not accept URLs with port 0
 [2020-09-20 13:39 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 02:01:30 2024 UTC