Commit 4e9d1f7d authored by Dries's avatar Dries

- Patch #342366 by John Morahan, Dave Reid, Damien Tournoud: fixed replacement...

- Patch #342366 by John Morahan, Dave Reid, Damien Tournoud: fixed replacement of unnamed placeholders in SQLite.
parent 5a53f843
...@@ -198,7 +198,10 @@ protected function getStatement($query, &$args = array()) { ...@@ -198,7 +198,10 @@ protected function getStatement($query, &$args = array()) {
// Else, this is using named placeholders. // Else, this is using named placeholders.
foreach ($args as $placeholder => $value) { foreach ($args as $placeholder => $value) {
if (is_numeric($value)) { if (is_numeric($value)) {
$query = str_replace($placeholder, $value, $query); // When replacing the placeholders, make sure we search for the
// exact placeholder. For example, if searching for
// ':db_placeholder_1', do not replace ':db_placeholder_11'.
$query = preg_replace('/' . preg_quote($placeholder) . '\b/', $value, $query);
unset($args[$placeholder]); unset($args[$placeholder]);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment