php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74780 parse_url() borken when query string contains colon
Submitted: 2017-06-19 12:13 UTC Modified: 2017-06-20 18:08 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dm@php.net Assigned: jhdxr (profile)
Status: Closed Package: URL related
PHP Version: 7.2.0alpha1 OS:
Private report: No CVE-ID: None
 [2017-06-19 12:13 UTC] dm@php.net
Description:
------------
When query string contains : (colon) parse_url() fails parses relative URIs improperly (like it happened before 5.4.7).

For 5.6 or older: If query string contains e.g. `a=1:337` then `port` will be `337`, when it's e.g. `a=b:c` then the port is correct.

https://3v4l.org/aBfGB

Test script:
---------------
<?php

var_dump(
    parse_url('//php.net/manual/en/function.parse-url.php?v=1:337')
);

Expected result:
----------------
array(3) {
  ["host"]=>
  string(7) "php.net"
  ["path"]=>
  string(33) "/manual/en/function.parse-url.php"
  ["query"]=>
  string(7) "v=1:337"
}

Actual result:
--------------
array(2) {
  ["path"]=>
  string(42) "//php.net/manual/en/function.parse-url.php"
  ["query"]=>
  string(7) "v=1:337"
}

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-20 18:08 UTC] jhdxr@php.net
-Summary: parse_url() borks when query string contains colon +Summary: parse_url() borken when query string contains colon -Status: Open +Status: Assigned -Package: *General Issues +Package: URL related -Assigned To: +Assigned To: jhdxr
 [2017-06-22 10:53 UTC] krakjoe@php.net
Automatic comment on behalf of jhdxr
Revision: http://git.php.net/?p=php-src.git;a=commit;h=db287b23030a2ac16bd9e2524d7e8bbe1b4a4d9a
Log: fix bug #74780 parse_url() borken when query string contains colon
 [2017-06-22 10:53 UTC] krakjoe@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Nov 18 08:03:32 2017 UTC