Bug #69976 [Csd]: Unable to parse "all" urls with colon char.
| From: | cmb@php.net | Date: | Thu, 02 Jul 2015 00:23:41 +0000 |
| Subject: | Bug #69976 [Csd]: Unable to parse "all" urls with colon char. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194052@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69976&edit=1
ID: 69976
Updated by: cmb@php.net
Reported by: flavio dot cambraia at yahoo dot com dot br
Summary: Unable to parse "all" urls with colon char.
Status: Closed
Type: Bug
Package: URL related
Operating System: Windows
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Good catch, Yasuo. Thanks. I'm, however, not sure if the change is
worth an entry in UPGRADING â it might mostly add noise. I can
imagine only rather weird edge cases to be affected, such as:
php -r "var_dump(parse_url('//u?er@example.com:8888/foo.bar'));"
Which currently gives:
bool(false)
and after the patch:
array(2) {
["path"]=>
string(3) "//u"
["query"]=>
string(27) "er@example.com:8888/foo.bar"
}
Both not very useful, the latter being definitely wrong wrt. RFC
1738, though. Maybe it's better to revert the commit? Then again,
the latter result is correct wrt. RFC 3986. It seems to me that we
need to decide which RFC is catered to by parse_url().
Previous Comments:
------------------------------------------------------------------------
[2015-07-01 23:11:15] yohgaki@php.net
@cmb
Could you add minor BC issue in UPGRADING?
------------------------------------------------------------------------
[2015-07-01 21:56:43] cmb@php.net
As the fix for this bug might be regarded as BC break (albeit a
minor one), I have committed to master (PHP 7.0.0) only.
------------------------------------------------------------------------
[2015-07-01 21:53:42] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e49922d3f8060e47f810a24ce48d4e622b493699
Log: Fix #69976: Unable to parse "all" urls with colon char
------------------------------------------------------------------------
[2015-07-01 12:17:00] flavio dot cambraia at yahoo dot com dot br
Description:
------------
The parsed url must have at least 6 chars after colon or it returns false.
Test script:
---------------
<?php
$res = parse_url("/busca/?fq=B:20001");
var_dump($res);
echo "<br>";
$res = parse_url("/busca/?fq=B:200013");
var_dump($res);
echo "<br>";
$res = parse_url("/busca/?fq=home:01234");
var_dump($res);
echo "<br>";
$res = parse_url("/busca/?fq=home:012345");
var_dump($res);
echo "<br>";
?>
Expected result:
----------------
The first and third parse return false. The second and fourth are ok.
It happens because of the colon char. It needs at least 6 chars after colon to parse correctly.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69976&edit=1