diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php index 2abbdcd31c..5fc75a613f 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php @@ -270,6 +270,14 @@ public function loadMultiple(array $ids = NULL) { $entities = []; $preloaded_entities = []; + // Validate IDs. + if ($ids) { + if ($invalid_ids = array_filter($ids, function ($id) { + return (!is_int($id) && !is_string($id)); + })) { + @trigger_error("Array of IDs passed to loadMultiple() must contain only strings or integers. This will throw an exception in drupal:11.0.0. Invalid IDs were: " . print_r($invalid_ids, TRUE), E_USER_DEPRECATED); + } + } // Create a new variable which is either a prepared version of the $ids // array for later comparison with the entity cache, or FALSE if no $ids // were passed. The $ids array is reduced as items are loaded from cache,