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 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: utirpan at hotmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Oct 10 14:01:27 2024 UTC