Req #66274 [Opn->Csd]: Support protocol-relative URLs in parse_url

From: Date: Tue, 27 Jan 2015 00:20:15 +0000
Subject: Req #66274 [Opn->Csd]: Support protocol-relative URLs in parse_url
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190239@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66274&edit=1 ID: 66274 Updated by: requinix@php.net Reported by: dmorilha at gmail dot com Summary: Support protocol-relative URLs in parse_url -Status: Open +Status: Closed Type: Feature/Change Request Package: URL related Operating System: macosx PHP Version: Irrelevant -Assigned To: +Assigned To: requinix Block user comment: N Private report: N New Comment: Fixed as of 5.4.7. http://3v4l.org/d8hSL ("PHP Version" isn't irrelevant, folks!) Previous Comments: ------------------------------------------------------------------------ [2015-01-26 22:14:46] me at evertpot dot com Currently this is documented as: > Partial URLs are also accepted So perhaps this is now a bug again? ------------------------------------------------------------------------ [2013-12-12 19:21:47] aharvey@php.net At present, parse_url() is only documented as supporting absolute URLs, so this is effectively a feature request. ------------------------------------------------------------------------ [2013-12-12 12:52:58] dmorilha at gmail dot com Description: ------------ parse_url gets lost when providing an url with no scheme in front, this goes totally against the RFC which allows urls with no scheme Test script: --------------- php > echo var_dump(parse_url("//search.yahoo.com/search?p=car")); array(2) { ["path"]=> string(25) "//search.yahoo.com/search" ["query"]=> string(5) "p=car" } php > echo var_dump(parse_url("http://search.yahoo.com/search?p=car")); array(4) { ["scheme"]=> string(4) "http" ["host"]=> string(16) "search.yahoo.com" ["path"]=> string(7) "/search" ["query"]=> string(5) "p=car" } Expected result: ---------------- php > echo var_dump(parse_url("//search.yahoo.com/search?p=car")); array(2) { ["host"]=> string(16) "search.yahoo.com" ["path"]=> string(7) "/search" ["query"]=> string(5) "p=car" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66274&edit=1

« previous php.bugs (#190239) next »