php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47288 Component parameter in parse_url does not work properly
Submitted: 2009-02-03 13:26 UTC Modified: 2009-07-25 10:52 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: hakan at e-bite dot se Assigned:
Status: Not a bug Package: URL related
PHP Version: 5.2.8 OS: XP and Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hakan at e-bite dot se
New email:
PHP Version: OS:

 

 [2009-02-03 13:26 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-03 13:31 UTC] 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 18:57 UTC] iliaa@php.net
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...
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 21:03:35 2022 UTC