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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 43 = ?
Subscribe to this entry?

 
 [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)

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 18 04:01:27 2024 UTC