php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54180 parse_url() incorrectly parses path when ? in fragment
Submitted: 2011-03-07 14:29 UTC Modified: 2011-03-13 05:03 UTC
From: gasper at kozak dot si Assigned: pierrick (profile)
Status: Closed Package: URL related
PHP Version: 5.3.5 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gasper at kozak dot si
New email:
PHP Version: OS:

 

 [2011-03-07 14:29 UTC] gasper at kozak dot si
Description:
------------
It seems that parse_url() ignores the path when fragment identifier includes a 
question mark (?). 

A few similar bugs were already reported (and fixed), but none of them is the 
same; this one affects the path part of the url.

Test script:
---------------
$p = parse_url('http://example.com/path/script.html#fragment?data');
print_r($p);


Expected result:
----------------
Array
(
    [scheme] => http
    [host] => example.com
    [path] => /path/script.html
    [fragment] => fragment?data
)


Actual result:
--------------
Array
(
    [scheme] => http
    [host] => example.com
    [fragment] => fragment?data
)


Patches

bug54180_patch (last revision 2011-03-07 22:33 UTC by tomas dot brastavicius at quantum dot lt)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-07 14:43 UTC] gasper at kozak dot si
This works if '?' is also present _before_ the fragment:

$p = parse_url('http://example.com/path/script.html?query#fragment?data');
print_r($p);

Outputs correctly:

Array
(
    [scheme] => http
    [host] => example.com
    [path] => /path/script.html
    [query] => query
    [fragment] => fragment?data
)
 [2011-03-13 05:02 UTC] pierrick@php.net
Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&revision=309159
Log: Fixed bug #54180 (parse_url() incorrectly parses path when ? in fragment)
 [2011-03-13 05:03 UTC] pierrick@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: pierrick
 [2011-03-17 19:03 UTC] pierrick@php.net
Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&revision=309352
Log: Fixed bug #54180 (parse_url() incorrectly parses path when ? in fragment)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC