|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53901 parse_url() discards invalid port number
Submitted: 2011-02-01 13:28 UTC Modified: 2011-02-04 12:19 UTC
From: aaz at althenia dot net Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.5 OS:
Private report: No CVE-ID: None
 [2011-02-01 13:28 UTC] aaz at althenia dot net

    [scheme] => http
    [host] =>

The port number "qq" is not included, so based on this output there is no way
to determine in later code that the URL was invalid.

Relatedly, the port number is returned as an int, while the manual says that
every component is returned as a string.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-01 14:18 UTC]
-Type: Bug +Type: Documentation Problem
 [2011-02-01 14:18 UTC]
Partially bogus, as the documentation says, "parse_url" is not meant to validate URLs. Use the filter extension for that.

The second part about it returning an int is true though.
 [2011-02-01 15:32 UTC] aaz at althenia dot net
I didn't expect parse_url() to validate the URL, but I did want it to
give me all the pieces that it found so I could validate or compare
them with other URLs myself.

Since internally php_url has an integer field for the port, I guess
it's too difficult to make it return the original port string.

Regarding the filter extension, the above URL passes validation (see
bug #49197).
 [2011-02-04 12:11 UTC]
Automatic comment from SVN on behalf of aharvey
Log: Fix doc bug #53901 (parse_url() discards invalid port number).
 [2011-02-04 12:19 UTC]
-Status: Open +Status: Closed -Package: URL related +Package: Documentation problem -Assigned To: +Assigned To: aharvey
 [2011-02-04 12:19 UTC]
Documentation fix committed. I've opened bug #53924 for the filter issue.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 15:01:27 2023 UTC