php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63162 parse_url does not matches password component
Submitted: 2012-09-25 19:18 UTC Modified: 2012-10-01 02:29 UTC
From: franssen dot roland at gmail dot com Assigned: stas (profile)
Status: Closed Package: URL related
PHP Version: 5.4.7 OS: Ubuntu
Private report: No CVE-ID: None
 [2012-09-25 19:18 UTC] franssen dot roland at gmail dot com
Description:
------------
Password component is not matched if only the authority part is given... it does matches however if a scheme is provided with it.

Due the difference between example 2 and 3 i'm not sure if a relative URI reference is supported or not.

Test script:
---------------
<?php
var_dump(parse_url('http://user:pass@host'));
var_dump(parse_url('//user:pass@host'));
var_dump(parse_url('//user@host'));

Expected result:
----------------
array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(4) "host"
  ["user"]=>
  string(4) "user"
  ["pass"]=>
  string(4) "pass"
}
array(3) {
  ["host"]=>
  string(4) "host"
  ["user"]=>
  string(4) "user"
  ["pass"]=>
  string(4) "pass"
}
array(2) {
  ["host"]=>
  string(4) "host"
  ["user"]=>
  string(4) "user"
}


Actual result:
--------------
array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(4) "host"
  ["user"]=>
  string(4) "user"
  ["pass"]=>
  string(4) "pass"
}
array(1) {
  ["path"]=>
  string(16) "//user:pass@host"
}
array(2) {
  ["host"]=>
  string(4) "host"
  ["user"]=>
  string(4) "user"
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-01 02:29 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2012-10-01 02:29 UTC] stas@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC