php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69976 Unable to parse "all" urls with colon char.
Submitted: 2015-07-01 12:17 UTC Modified: 2015-07-02 00:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: flavio dot cambraia at yahoo dot com dot br Assigned: cmb (profile)
Status: Closed Package: URL related
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2015-07-01 12:17 UTC] 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.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-01 21:21 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2015-07-01 21:53 UTC] 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 &quot;all&quot; urls with colon char
 [2015-07-01 21:53 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2015-07-01 21:56 UTC] 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 23:11 UTC] yohgaki@php.net
@cmb

Could you add minor BC issue in UPGRADING?
 [2015-07-02 00:23 UTC] cmb@php.net
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().
 [2015-07-07 23:37 UTC] ab@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 &quot;all&quot; urls with colon char
 [2016-07-20 11:38 UTC] davey@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 &quot;all&quot; urls with colon char
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC