php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20919 parse_url mishandles usernames with '@' signs
Submitted: 2002-12-10 05:10 UTC Modified: 2002-12-10 05:13 UTC
From: danny at kyboshed dot com Assigned:
Status: Not a bug Package: URL related
PHP Version: 4.2.3 OS: FreeBSD 4.6
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: danny at kyboshed dot com
New email:
PHP Version: OS:

 

 [2002-12-10 05:10 UTC] danny at kyboshed dot com
parse_url breaks if a username containing an '@' sign is used: 

<?php

$url=parse_url('http://me@abc.com:pass@xyz.org/page.php');
var_dump($url);

?>

Returns:

array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(7) "abc.com"
  ["user"]=>
  string(2) "me"
  ["path"]=>
  string(9) "/page.php"
}

Should return:

array(5) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(7) "xyz.org"
  ["user"]=>
  string(10) "me@abc.com"
  ["pass"]=>
  string(4) "pass"
  ["path"]=>
  string(9) "/page.php"
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-10 05:13 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Not a bug, it's an URL, and you need to encode characters in there. (for example with urlencode).

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC