Issue #3575945: Add hasService('database') guard in CacheBase::deleteMultiple()

by foxtrotcharlie:

Closes #3575945

Adds \Drupal::hasService('database') to the existing hasContainer() guard in CacheBase::deleteMultiple().

During container compilation (e.g. triggered by HookCollectorKeyValueWritePass in Drupal 11.3), hasContainer() returns TRUE but the database service definition has not yet been registered,causing a ServiceNotFoundException. This broke ExistingSite tests (weitzman/drupal-test-traits) during setUp().

The fix adds a hasService() check between hasContainer() and the database() call, which is a minimal and safe guard.

Edited by Charles Tanton

Merge request reports

Loading