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

From: Date: Thu, 12 Dec 2013 19:21:48 +0000
Subject: Bug->Req #66274 [Opn]: Support protocol-relative URLs in parse_url
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183274@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: aharvey@php.net Reported by: dmorilha at gmail dot com -Summary: parse_url depends on scheme +Summary: Support protocol-relative URLs in parse_url Status: Open -Type: Bug +Type: Feature/Change Request -Package: *General Issues +Package: URL related Operating System: macosx PHP Version: Irrelevant Block user comment: N Private report: N New Comment: At present, parse_url() is only documented as supporting absolute URLs, so this is effectively a feature request. Previous Comments: ------------------------------------------------------------------------ [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 (#183274) next »