Req #67875 [Com]: parse_url behavior request

From: Date: Sat, 25 Jun 2016 02:11:55 +0000
Subject: Req #67875 [Com]: parse_url behavior request
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201839@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 Comment by: webmaster at tubo-world dot de 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: This issue should be closed. The URI reference "example.com/foo" is a relative path reference. So example.com is not the host in the above URI as you expect wrongly. See RFC 3986. The correct URI reference would be "//example.com/foo" for what you are trying to express. Previous Comments: ------------------------------------------------------------------------ [2014-08-20 18:35:08] requinix@php.net 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 "//". ------------------------------------------------------------------------ [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

« previous php.bugs (#201839) next »