#47288 [Opn->Bgs]: Component parameter in parse_url does not work properly
ID: 47288
Updated by: iliaa@php.net
Reported By: hakan at e-bite dot se
-Status: Open
+Status: Bogus
Bug Type: *URL Functions
Operating System: XP and Linux
PHP Version: 5.2.8
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
The url does not have a trailing /, so there is no path...
Previous Comments:
------------------------------------------------------------------------
[2009-02-03 13:31:15] hakan at e-bite dot se
PS PHP_URL_PATH is just an example. Expected result for scheme and host
is not as stated. I also tried PHP_URL_SCHEME and PHP_URL_HOST with
slightly different results.
Håkan
------------------------------------------------------------------------
[2009-02-03 13:26:06] hakan at e-bite dot se
Description:
------------
Parse_url() function does not work properly with component parameter as
manual:
http://www.php.net/manual/en/function.parse-url.php
The function works well without the parameter
Tested:
PHP Version 5.2.8 on Win XP
PHP Version 5.2.0-8+etch13 on Linux
Håkan Askengren
e-bite
Reproduce code:
---------------
$url="http://www.php.net";
//Without component parameter, Works OK
$urlInfo = parse_url($url );
var_dump($urlInfo);
//With component parameter
$urlInfo = parse_url($url, PHP_URL_PATH );
var_dump($urlInfo);
Expected result:
----------------
Expected:
array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
}
array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
}
Actual result:
--------------
Actual:
array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
}
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47288&edit=1
Thread (3 messages)