Bug #68917 [Com]: parse_url fails on some partial urls
| From: | me at evertpot dot com | Date: | Tue, 27 Jan 2015 00:43:52 +0000 |
| Subject: | Bug #68917 [Com]: parse_url fails on some partial urls | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190240@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68917&edit=1
ID: 68917
Comment by: me at evertpot dot com
Reported by: me at evertpot dot com
Summary: parse_url fails on some partial urls
Status: Verified
Type: Bug
Package: *URL Functions
Operating System: any
PHP Version: 5.6.5
Block user comment: N
Private report: N
New Comment:
Yea, I think it can really use a deep look into RFC3986 and a fresh start :) It looks like it had a
number of edge-cases fixed in the past.
Previous Comments:
------------------------------------------------------------------------
[2015-01-27 00:16:58] requinix@php.net
http://3v4l.org/MpY8k
I can't quite wrap my head around what ext/standard/url.c's php_url_parse_ex is doing
without a debugger but it seems the combination of a colon + numbers and leading slash(es) confuses
the code.
It also seems like the same problem as in bug #66813 except this time the (unencoded) colon is in
the right location.
------------------------------------------------------------------------
[2015-01-26 22:16:52] me at evertpot dot com
Description:
------------
parse_url will fail for urls that don't have a scheme, but do have a port
Test script:
---------------
<?php
print_r(parse_url('//example.org:81/hi?a=b#c=d'));
print_r(parse_url('//example.org/hi?a=b#c=d'));
Expected result:
----------------
Array
(
[host] => example.org
[port] => 81
[path] => /hi
[query] => a=b
[fragment] => c=d
)
Array
(
[host] => example.org
[path] => /hi
[query] => a=b
[fragment] => c=d
)
Actual result:
--------------
Array
(
[host] => example.org
[path] => /hi
[query] => a=b
[fragment] => c=d
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68917&edit=1