Bug #68917 [Opn->Ver]: parse_url fails on some partial urls
| From: | requinix@php.net | Date: | Tue, 27 Jan 2015 00:16:58 +0000 |
| Subject: | Bug #68917 [Opn->Ver]: parse_url fails on some partial urls | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190238@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
Updated by: requinix@php.net
Reported by: me at evertpot dot com
Summary: parse_url fails on some partial urls
-Status: Open
+Status: Verified
Type: Bug
Package: *URL Functions
Operating System: any
PHP Version: 5.6.5
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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