summaryrefslogtreecommitdiff
path: root/includes/database/query.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/database/query.inc')
-rw-r--r--includes/database/query.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/database/query.inc b/includes/database/query.inc
index 6ca869e52..b6b47f48d 100644
--- a/includes/database/query.inc
+++ b/includes/database/query.inc
@@ -1161,6 +1161,13 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
}
public function compile(DatabaseConnection $connection) {
+ // This value is static, so it will increment across the entire request
+ // rather than just this query. That is OK, because we only need definitive
+ // placeholder names if we're going to use them for _alter hooks, which we
+ // are not. The alter hook would intervene before compilation.
+ // $next_placeholder does not use drupal_static as it increments and should
+ // never be reset during a request.
+ static $next_placeholder = 1;
if ($this->changed) {
@@ -1213,7 +1220,7 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
}
if ($operator['use_value']) {
foreach ($condition['value'] as $value) {
- $placeholder = ':db_condition_placeholder_' . $connection->getNextPlaceholder();
+ $placeholder = ':db_condition_placeholder_' . $next_placeholder++;
$arguments[$placeholder] = $value;
$placeholders[] = $placeholder;
}