php.net |  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
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:
28 + 36 = ?
Subscribe to this entry?

 
 [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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

http://www.organiKa.com.br/floripa/PEAR/urldecode.php

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] cox@php.net
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: Fri Apr 26 16:01:29 2024 UTC