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

From: Date: Tue, 01 Feb 2011 14:32:09 +0000
Subject: Doc #53901 [Opn]: parse_url() discards invalid port number
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5905@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 User updated by: aaz at althenia dot net Reported by: aaz at althenia dot net Summary: parse_url() discards invalid port number Status: Open Type: Documentation Problem Package: URL related PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: 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). Previous Comments: ------------------------------------------------------------------------ [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 (#5905) next »