#38859 [NEW]: parse_url fails if passing '@' in passwd
From: schappy at mail dot ru
Operating system: all
PHP version: 4.4.4
PHP Bug Type: URL related
Bug description: parse_url fails if passing '@' in passwd
Description:
------------
If you specify a username/password containing a '@'-sign the parse_url
will not decode the password correctly.
See example below.
While parsing the string, it should be used the last index of '@' to find
the hostname instead of the first occurence.
Reproduce code:
---------------
<?php
$url = 'http://user:@pass@host/path?argument?value#etc';
print_r(parse_url($url));
?>
Array
(
[scheme] => http
[host] => pass@host
[user] => user
[path] => /path
[query] => argument?value
[fragment] => etc
)
Expected result:
----------------
<?php
$url = 'http://user:@pass@host/path?argument?value#etc';
print_r(parse_url($url));
?>
Array
(
[scheme] => http
[pass] => @pass
[host] => host
[user] => user
[path] => /path
[query] => argument?value
[fragment] => etc
)
--
Edit bug report at http://bugs.php.net/?id=38859&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38859&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38859&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38859&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38859&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38859&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38859&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38859&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38859&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38859&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38859&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38859&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38859&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38859&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38859&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38859&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38859&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38859&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38859&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38859&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38859&r=mysqlcfg
Thread (3 messages)
- schappy at mail dot ru