RE: [PHP-DOC] parse_url bug/feature?
| From: | Steven Larsen | Date: | Wed, 18 Sep 2002 20:04:15 +0000 |
| Subject: | RE: [PHP-DOC] parse_url bug/feature? | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969348741@lists.php.net to get a copy of this message | ||
Hartmut Holzgraefe wrote:
>
>valid and expected behaviour
>
>if no scheme is given the argument is treated as a filesystem path,
>here a file named "www.homecentricity.com" in the current working
>directory
>
>just because browsers take input like this in their location bars
>as http URLs doesn't say everything should
Hmmm... the PHP Documentation states (with my *highlighting*):
"This function returns an associative array returning *any* of the various
components of the URL *that are present*
*Partial urls are also accepted*, parse_url() *tries its best to parse them
correctly*"
Based on the documentation, it is *not* valid and expected behavior. Given
that the function is "parse_url" and not "parse_file", and that the
intention of the function is not to validate but to decipher it into it's
component parts, the default for no scheme should not be to assume it is a
file but to assume that it is a partial or malformed url. If the function
worked according to the documentation, I would expect that
www.homecentricity.com would return the following:
scheme = NULL
host = www.homecentricity.com
Either something is not working correctly or the documentation needs to be
corrected to state your comments above.
-Steve