diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2012-09-17 22:04:16 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2012-09-17 22:04:16 +0200 |
commit | 8f098e8dead85b6512ac72b2d805314baec72a2f (patch) | |
tree | 96b89dbcc2a58dab0f2dd1183beef3036c13287f /program/include/rcube_db.php | |
parent | 99d9f50a0000447d0a752e6c43716237dc0da176 (diff) | |
parent | 6898b420ed4eb2bd2d1933758cde27bdd305d72a (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/include/rcube_db.php')
-rw-r--r-- | program/include/rcube_db.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/program/include/rcube_db.php b/program/include/rcube_db.php index f97d70ab3..eb1ad31b2 100644 --- a/program/include/rcube_db.php +++ b/program/include/rcube_db.php @@ -388,13 +388,19 @@ class rcube_db $idx = 0; while ($pos = strpos($query, '?', $pos)) { - $val = $this->quote($params[$idx++]); - unset($params[$idx-1]); - $query = substr_replace($query, $val, $pos, 1); - $pos += strlen($val); + if ($query[$pos+1] == '?') { // skip escaped ? + $pos += 2; + } + else { + $val = $this->quote($params[$idx++]); + unset($params[$idx-1]); + $query = substr_replace($query, $val, $pos, 1); + $pos += strlen($val); + } } - $query = rtrim($query, ';'); + // replace escaped ? back to normal + $query = rtrim(strtr($query, array('??' => '?')), ';'); $this->debug($query); @@ -591,7 +597,7 @@ class rcube_db 'integer' => PDO::PARAM_INT, ); $type = isset($map[$type]) ? $map[$type] : PDO::PARAM_STR; - return $this->dbh->quote($input, $type); + return strtr($this->dbh->quote($input, $type), array('?' => '??')); // escape ? } return 'NULL'; |