Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In my case problem happens only when many languages enabled:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens: SELECT 1 AS expression [error]
FROM
{xmlsitemap} xmlsitemap
WHERE (type = :db_condition_placeholder_0) AND (id = :db_condition_placeholder_1) AND (language =
:db_condition_placeholder_2:db_condition_placeholder_3:db_condition_placeholder_4:db_condition_placeholder_5:db_condition_placeholder_6) AND (status = :db_condition_placeholder_7) AND (access =
:db_condition_placeholder_8)
LIMIT 1 OFFSET 0; Array
(
[:db_condition_placeholder_0] => node
[:db_condition_placeholder_1] => 385
[:db_condition_placeholder_2] => en-001
[:db_condition_placeholder_3] => en-au
[:db_condition_placeholder_4] => en-eu
[:db_condition_placeholder_5] => en-gb
[:db_condition_placeholder_6] => en-za
[:db_condition_placeholder_7] => 1
[:db_condition_placeholder_8] => 1
)
in Drupal\xmlsitemap\XmlSitemapLinkStorage->checkChangedLinks() (line 220 of xmlsitemap/src/XmlSitemapLinkStorage.php).
Reason:
$query = db_select('xmlsitemap');
$query->addExpression('1');
foreach ($conditions as $field => $value) {
$query->condition($field, $value); // <== $value can be array.
}
$query->range(0, 1);
$changed = $query->execute()->fetchField();
Comment | File | Size | Author |
---|---|---|---|
#4 | 2991052-fix-array-condition-query.patch | 5.08 KB | Dave Reid |
| |||
#2 | xmlsitemap-invalid_parameter_number-2991052-D8.patch | 630 bytes | chilic |
Comments
Comment #2
chilic CreditAttribution: chilic as a volunteer and commentedComment #3
chilic CreditAttribution: chilic at DrupalSquad commentedComment #4
Dave ReidI found a couple more places where this could happen, and I fixed the service to inject the database connection.
Comment #6
Dave Reid