Req #67875 [Opn]: parse_url behavior request
| From: | requinix@php.net | Date: | Wed, 20 Aug 2014 18:35:09 +0000 |
| Subject: | Req #67875 [Opn]: parse_url behavior request | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187208@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67875&edit=1
ID: 67875
Updated by: requinix@php.net
Reported by: christopher dot geisel at gmail dot com
Summary: parse_url behavior request
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: CentOS 6.5
PHP Version: 5.4.31
Block user comment: N
Private report: N
New Comment:
It may not be intuitive but it is the correct behavior: clicking a
<a href="www.example.com">Go to http://www.example.com</a>
will not take you to the example domain.
Custom TLDs make this even worse. "example.com", sure it's a .com so it's
probably a domain, but what about "example.foo" or "example.xyz"? I've seen
those used as file extensions to obscure the underlying language. (Poorly.) There's even
"example.cab" which IS an actual file extension - not to mention ".com" itself.
Besides that is the argument that it should parse according to the rules for a URL (RFC 3986).
If you want to force a domain name, all you have to do is prefix a "//".
Previous Comments:
------------------------------------------------------------------------
[2014-08-20 17:58:20] christopher dot geisel at gmail dot com
Description:
------------
parse_url feature request: parse on "/" for path
The behavior where parse_url sets "path" in the absence of a scheme/port is documented,
but not intuitive.
Proposal: parse on "/" for the path. In the absence of scheme/port, set host with whatever
precedes the path.
Test script:
---------------
https://gist.github.com/cgeisel/d85f1175d570fb20534e
Expected result:
----------------
See comments in gist
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67875&edit=1