|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36351 parse_url does not parse path correctly.
Submitted: 2006-02-10 14:09 UTC Modified: 2006-02-12 17:41 UTC
From: adam at nojszewski dot com Assigned: iliaa (profile)
Status: Closed Package: URL related
PHP Version: 5.1.2 OS:
Private report: No CVE-ID: None
 [2006-02-10 14:09 UTC] adam at nojszewski dot com
parse_url does not parses 'scheme:path' when path consists of numbers only. 

skype:anojszewski is parsed right.
gg:9130731 is parsed wrong (whole URL is treated as path).

Tested on versions 5.1.2 and 4.4.2.

Adam Nojszewski

Reproduce code:

Expected result:
    [scheme] => skype
    [path] => anojszewski
    [scheme] => gg
    [path] => 9130731

Actual result:
    [scheme] => skype
    [path] => anojszewski
    [path] => gg:9130731


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-10 14:48 UTC] adam at nojszewski dot com
I have found a cause of this behavior

URL like string:number are generaly treated as host:port when nuber is [0,65535]. 

When number is [65536,99999] function wraps it to values [0,34463]. 

When nuber is more than 5 digits long function treats it as part of a path.

But web browsers treat specific combinations (i.e. 'mailto:555') not as host:port, but as scheme:path.
 [2006-02-10 15:19 UTC]
Ilia, please take a look at it.
 [2006-02-12 17:41 UTC]
This bug has been fixed in CVS.

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

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 18:01:30 2024 UTC