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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 + 39 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 25 19:01:33 2024 UTC