|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73500 parse_url behaviour changed between 7.0.12 and 7.0.13 when pw begins with #
Submitted: 2016-11-11 15:08 UTC Modified: 2016-11-13 16:07 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: max at substrakt dot com Assigned:
Status: Wont fix Package: URL related
PHP Version: 7.0.13 OS: Ubuntu Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: max at substrakt dot com
New email:
PHP Version: OS:


 [2016-11-11 15:08 UTC] max at substrakt dot com
When running the following code on PHP 7.0.12 and 7.0.13, a different result is returned.

In the later version, the user and pass attributes are missing. This _only_ occurs when the first character of the password is # (hash/pound). Strong passwords can often include the # symbol so this is unexpected behaviour.

I've not raised a bug in PHP before, please let me know if you need further information to resolve this!

Test script:
    $url = "mysql://";

Expected result:
array(6) {
  string(5) "mysql"
  string(32) ""
  string(4) "user"
  string(12) "#fhdsjfghjdf"
  string(14) "/database_name"

Actual result:
array(3) {
  string(5) "mysql"
  string(4) "user"
  string(63) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-11 15:22 UTC]
Just like for other parts of a URI, it is necessary to URL-encode passwords (for example, using the urlencode() function). The "#" in your password should be "%23" instead.

As bug #73192, which resulted in this change, is classified as a security bug, I don't think we'll take further action here.
 [2016-11-13 16:07 UTC]
-Status: Open +Status: Wont fix
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 10:01:31 2024 UTC