#47288 [Opn]: Component parameter in parse_url does not work properly
| From: | hakan at e-bite dot se | Date: | Tue, 03 Feb 2009 13:31:15 +0000 |
| Subject: | #47288 [Opn]: Component parameter in parse_url does not work properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133428@lists.php.net to get a copy of this message | ||
ID: 47288
User updated by: hakan at e-bite dot se
Reported By: hakan at e-bite dot se
Status: Open
Bug Type: *URL Functions
Operating System: XP and Linux
PHP Version: 5.2.8
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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