Issue #3479153 by phenaproxima, b_sharpe: InputConfigurator::collectAll() should use an internal passed-in recursion tracker, not a static variable

(cherry picked from commit b72df4495e)
merge-requests/9877/head
Alex Pott 2024-10-18 09:21:30 +01:00
parent 32a4edcc40
commit 7634702ca9
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
1 changed files with 5 additions and 3 deletions

View File

@ -124,18 +124,20 @@ final class InputConfigurator {
*
* @param \Drupal\Core\Recipe\InputCollectorInterface $collector
* The input collector to use.
* @param string[] $processed
* The names of the recipes for which input has already been collected.
* Internal use only, should not be passed in by calling code.
*
* @throws \Symfony\Component\Validator\Exception\ValidationFailedException
* Thrown if any of the collected values violate their validation
* constraints.
*/
public function collectAll(InputCollectorInterface $collector): void {
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.
static $processed = [];
if (in_array($this->prefix, $processed, TRUE)) {
return;
}
@ -143,7 +145,7 @@ final class InputConfigurator {
// First, collect values for the recipe's dependencies.
/** @var \Drupal\Core\Recipe\Recipe $dependency */
foreach ($this->dependencies->recipes as $dependency) {
$dependency->input->collectAll($collector);
$dependency->input->collectAll($collector, $processed);
}
$this->values = [];