php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74281 parse_url returns false
Submitted: 2017-03-21 11:37 UTC Modified: 2017-03-21 11:41 UTC
From: alex at 2sun dot su Assigned:
Status: Duplicate Package: URL related
PHP Version: 7.1.3 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alex at 2sun dot su
New email:
PHP Version: OS:

 

 [2017-03-21 11:37 UTC] alex at 2sun dot su
Description:
------------
URL like this:

scheme://example_login:!#Password?@ZZZ@127.0.0.1/some_path

parse_url returns false in PHP 7.1.3, 7.0.14, 5.6.29 (I have this versions available)

But all works as expected in PHP 7.0.5, 5.6.20

Test script:
---------------
var_dump( parse_url("scheme://example_login:!#Password?@ZZZ@127.0.0.1/some_path") );

Expected result:
----------------
array(5) {
  ["scheme"]=>
  string(6) "scheme"
  ["host"]=>
  string(9) "127.0.0.1"
  ["user"]=>
  string(13) "example_login"
  ["pass"]=>
  string(15) "!#Password?@ZZZ"
  ["path"]=>
  string(10) "/some_path"
}


Actual result:
--------------
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-21 11:41 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2017-03-21 11:41 UTC] requinix@php.net
The URL is invalid: the password needs to be percent-encoded. It worked in previous versions due to a bug.
 [2017-03-21 11:53 UTC] daverandom@php.net
Previous bug: https://bugs.php.net/bug.php?id=73192
 [2021-03-20 09:31 UTC] djavolak at mail dot ru
confirmed as well on PHP 8.0.2

everything with semicolon after the scheme makes it return false.
 [2021-03-20 09:42 UTC] djavolak at mail dot ru
my bad, missed previous bug info.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 07:01:27 2025 UTC