Req #66274 [Com]: Support protocol-relative URLs in parse_url

From: Date: Mon, 26 Jan 2015 22:14:47 +0000
Subject: Req #66274 [Com]: Support protocol-relative URLs in parse_url
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190235@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 Comment by: me at evertpot dot com Reported by: dmorilha at gmail dot com Summary: Support protocol-relative URLs in parse_url Status: Open Type: Feature/Change Request Package: URL related Operating System: macosx PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Currently this is documented as: > Partial URLs are also accepted So perhaps this is now a bug again? Previous Comments: ------------------------------------------------------------------------ [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 (#190235) next »