Bug #3748 [NEW]: postgres password does not escape spaces.

From: Date: Tue, 08 Mar 2005 21:46:32 +0000
Subject: Bug #3748 [NEW]: postgres password does not escape spaces.
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-5629@lists.php.net to get a copy of this message
From: phadley at village dot com Operating system: Linux/FreeBSD PHP version: 4.2.2 Package: Documentation Bug Type: Bug Bug description: postgres password does not escape spaces. 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 bug report at http://pear.php.net/bugs/bug.php?id=3748&edit=1 --

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