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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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)

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 22:01:28 2024 UTC