- Patch #958850 by bellHead: Postgres password containing backslashes don't work.

merge-requests/26/head
Dries Buytaert 2011-05-08 16:36:29 -04:00
parent 98256f2df1
commit b7062f4b21
1 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,15 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
if (empty($connection_options['password'])) {
$connection_options['password'] = NULL;
}
// If the password contains a backslash it is treated as an escape character
// http://bugs.php.net/bug.php?id=53217
// so backslashes in the password need to be doubled up.
// The bug was reported against pdo_pgsql 1.0.2, backslashes in passwords
// will break on this doubling up when the bug is fixed, so check the version
//elseif (phpversion('pdo_pgsql') < 'version_this_was_fixed_in') {
else {
$connection_options['password'] = str_replace('\\', '\\\\', $connection_options['password']);
}
$this->connectionOptions = $connection_options;