Doc #53901 [Opn->Csd]: parse_url() discards invalid port number

From: Date: Fri, 04 Feb 2011 11:19:15 +0000
Subject: Doc #53901 [Opn->Csd]: parse_url() discards invalid port number
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5918@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53901&edit=1 ID: 53901 Updated by: aharvey@php.net Reported by: aaz at althenia dot net Summary: parse_url() discards invalid port number -Status: Open +Status: Closed Type: Documentation Problem -Package: URL related +Package: Documentation problem PHP Version: 5.3.5 -Assigned To: +Assigned To: aharvey Block user comment: N Private report: N New Comment: Documentation fix committed. I've opened bug #53924 for the filter issue. Previous Comments: ------------------------------------------------------------------------ [2011-02-04 12:11:08] aharvey@php.net Automatic comment from SVN on behalf of aharvey Revision: http://svn.php.net/viewvc/?view=revision&revision=308017 Log: Fix doc bug #53901 (parse_url() discards invalid port number). ------------------------------------------------------------------------ [2011-02-01 15:32:09] 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-01 14:18:31] cataphract@php.net 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 13:28:17] aaz at althenia dot net Description: ------------ parse_url("http://example.com:qq"); Array ( [scheme] => http [host] => example.com ) 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53901&edit=1

« previous php.doc.bugs (#5918) next »