#43721 [Opn->Bgs]: parse_url does not handle "protocol relative" URLs

From: Date: Mon, 31 Dec 2007 21:27:23 +0000
Subject: #43721 [Opn->Bgs]: parse_url does not handle "protocol relative" URLs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120962@lists.php.net to get a copy of this message
 ID:               43721
 Updated by:       iliaa@php.net
 Reported By:      phpbugs at thequod dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         URL related
 Operating System: Ubuntu Linux
 PHP Version:      5.2.5
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

That's expected, because unless a protocol is specified, it assumes 
file://


Previous Comments:
------------------------------------------------------------------------

[2007-12-31 18:10:32] phpbugs at thequod dot de

Description:
------------
parse_url does not parse "protocol relative" URLs correctly.

"protocol relative" URLs start with to slashes, leaving the "proto:" 
part out.

parse_url should parse them like a "http://" url, but leave 
the "protocol" key unset, as far as I can see.

See RFC3986.

Reproduce code:
---------------
$ php -r '$p = parse_url("//example.com/bar"); var_dump($p);'


Expected result:
----------------
array(2) {
  ["host"]=>
  string(11) "example.com"
  ["path"]=>
  string(17) "/bar"
}


Actual result:
--------------
array(1) {
  ["path"]=>
  string(17) "//example.com/bar"
}



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43721&edit=1


Thread (5 messages)

« previous php.bugs (#120962) next »