From bd90218c19fee87ceba0db0e6a619119c352af59 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Thu, 23 Sep 2021 11:03:15 +0100
Subject: [PATCH] Issue #3232695 by alexpott: Only process values in config
 entity query conditions for operators that have values

---
 .../Drupal/Core/Config/Entity/Query/Condition.php | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Condition.php b/core/lib/Drupal/Core/Config/Entity/Query/Condition.php
index 420bc0d3dccb..a1a03409ccd2 100644
--- a/core/lib/Drupal/Core/Config/Entity/Query/Condition.php
+++ b/core/lib/Drupal/Core/Config/Entity/Query/Condition.php
@@ -29,12 +29,15 @@ public function compile($configs) {
           $condition['operator'] = is_array($condition['value']) ? 'IN' : '=';
         }
 
-        // Lowercase condition value(s) for case-insensitive matches.
-        if (is_array($condition['value'])) {
-          $condition['value'] = array_map('mb_strtolower', $condition['value']);
-        }
-        elseif (!is_bool($condition['value'])) {
-          $condition['value'] = mb_strtolower($condition['value']);
+        // Process the value for operator that use it.
+        if (!in_array($condition['operator'], ['IS NULL', 'IS NOT NULL'], TRUE)) {
+          // Lowercase condition value(s) for case-insensitive matches.
+          if (is_array($condition['value'])) {
+            $condition['value'] = array_map('mb_strtolower', $condition['value']);
+          }
+          elseif (!is_bool($condition['value'])) {
+            $condition['value'] = mb_strtolower($condition['value']);
+          }
         }
 
         $single_conditions[] = $condition;
-- 
GitLab