Bug #3748 [Opn->Fbk]: postgres password does not escape spaces.

From: Date: Tue, 08 Mar 2005 23:26:57 +0000
Subject: Bug #3748 [Opn->Fbk]: postgres password does not escape spaces.
References: 1  Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-5631@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=3748&edit=1 ID: 3748 Updated by: danielc@analysisandsolutions.com Reported By: phadley at village dot com -Status: Open +Status: Feedback Type: Bug Package: Documentation Operating System: Linux/FreeBSD PHP Version: 4.2.2 -Assigned To: +Assigned To: danielc New Comment: Upgrade your version of DB and call me in the morning. Previous Comments: ------------------------------------------------------------------------ [2005-03-08 16:46:32] phadley at village dot com Description: ------------ In assembling the connections string from the dns info, the addslashes function does not slash spaces. I get around this with either str_replace or by placing escaped single quote marks before and after. Reproduce code: --------------- lines 103-107 of pear/DB/pgsql.php v.1.65.2.3 as I've modified it. The first and third variations work. The second one doesn't and the fourth one came with my package. The second alternative (addslashes) was taken from the newer verson. The fourth line is what I have on my personal machine. if (!empty($dsninfo['password'])) { $connstr .= ' password=' . str_replace(' ','\ ',$dsninfo['password']); # $connstr .= ' password=' . addslashes($dsninfo['password']); # $connstr .= ' password=\'' . $dsninfo['password'].'\''; # $connstr .= ' password=' . $dsninfo['password']; Expected result: ---------------- I expect to be able to connect to the database even if my password has a space. Actual result: -------------- It doesn't connect because it thinks the password is only the first word in the phrase. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=3748&edit=1

« previous php.pear.doc (#5631) next »