|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18323 Bug in DB module
Submitted: 2002-07-12 23:12 UTC Modified: 2002-07-14 23:23 UTC
From: utirpan at hotmail dot com Assigned:
Status: Not a bug Package: PEAR related
PHP Version: 4.2.1 OS: Windows NT 4
Private report: No CVE-ID: None
 [2002-07-12 23:12 UTC] utirpan at hotmail dot com
PEAR/DB.php:line 482

$parsed['password'] = urldecode(substr $str, $pos + 1));

urldecode changes password values: 
password="abc+d" -> bcomes -> password="abc d"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-13 09:32 UTC]
That's not true (at least on UNIX).
See an example at:

I think this maybe not a PEAR related issue but a problem with urlencode()/urldecode() on Windows.

Can you please try to execute that code on your system to see if you get the same result as on UNIX?
 [2002-07-13 12:43 UTC]
This is not a bug in PHP or DB. PEAR DB provides a way to escape chars that can be confused with other parts of the DSN.

In this case, you should use:
$pass = urlencode($pass);
$dsn = mysql://foo:$pass@bar

In the lastest version of the parseDSN() function, perhaps there is no more need to do that, I'll look to see if we can remove that requirement in the future.

Tomas V.V.Cox
 [2002-07-14 23:23 UTC] utirpan at hotmail dot com
The code you submitted works on Windows.
But the code below wont work(just like in DOCs):

$pass = 'abc+d';
$dsn = "mysql://$user:$pass@$host/$db_name";
$db = DB::connect($dsn, true);

As Thomas says, it is looks like a DSN issue.
This needs to be documented in PEAR. 
I apologize posting this as PEAR bug, I am not
a PHP code expert.

Thanks for all prompt responses.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 23:01:30 2024 UTC