php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50073 parse_url incorrect when ? in fragment
Submitted: 2009-11-04 09:01 UTC Modified: 2009-11-04 13:44 UTC
From: kurt at blackwell dot id dot au Assigned: iliaa
Status: Closed Package: URL related
PHP Version: 5.*, 6 OS: *
Private report: No CVE-ID:
 [2009-11-04 09:01 UTC] kurt at blackwell dot id dot au
Description:
------------
parse_url incorrectly parses URLs with no query and a '?' in the 
fragment.  It will either interpret the fragment as the query, or split 
the fragment between the host and query.

Reproduce code:
---------------
print_r(parse_url('http://www.example.com/#a?b'));
print_r(parse_url('http://www.example.com#a?b'));

Expected result:
----------------
Array
(
    [scheme] => http
    [host] => www.example.com
    [path] => /
    [fragment] => a?b
)
Array
(
    [scheme] => http
    [host] => www.example.com
    [fragment] => a?b
)

Actual result:
--------------
Array
(
    [scheme] => http
    [host] => www.example.com
    [path] => /
    [query] => a?b
)
Array
(
    [scheme] => http
    [host] => www.example.com#a
    [query] => b
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-04 13:44 UTC] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=290199
Log: Fixed bug #50073 (parse_url() incorrect when ? in fragment).
 [2009-11-04 13:44 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 08:02:33 2014 UTC