From dd90bb9095af8b1f14c70f8fc6db6d8a6e94f9b7 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 19 Nov 2024 16:05:36 +0000
Subject: [PATCH] Issue #3488179 follow-up by alexpott:
 RecipeConfigurator::getIncludedRecipe() should statically cache recipe
 objects to avoid performance problems

(cherry picked from commit e2a92ae2480b03aafbd394b3806854c0c50be8b8)
---
 core/lib/Drupal/Core/Recipe/InputConfigurator.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/lib/Drupal/Core/Recipe/InputConfigurator.php b/core/lib/Drupal/Core/Recipe/InputConfigurator.php
index 4e429ef70cf0..9b324ed29aa3 100644
--- a/core/lib/Drupal/Core/Recipe/InputConfigurator.php
+++ b/core/lib/Drupal/Core/Recipe/InputConfigurator.php
@@ -133,15 +133,15 @@ public function describeAll(): array {
    *   constraints.
    */
   public function collectAll(InputCollectorInterface $collector, array &$processed = []): void {
-    if (is_array($this->values)) {
-      throw new \LogicException('Input values cannot be changed once they have been set.');
-    }
-
     // Don't bother collecting values for a recipe we've already seen.
     if (in_array($this->prefix, $processed, TRUE)) {
       return;
     }
 
+    if (is_array($this->values)) {
+      throw new \LogicException('Input values cannot be changed once they have been set.');
+    }
+
     // First, collect values for the recipe's dependencies.
     /** @var \Drupal\Core\Recipe\Recipe $dependency */
     foreach ($this->dependencies->recipes as $dependency) {
-- 
GitLab