From f33949809b4f27c54ac111c896d3edcc0bc86cb3 Mon Sep 17 00:00:00 2001 From: Jordi Dekker Date: Mon, 16 Feb 2026 11:40:51 +0100 Subject: [PATCH] Fix null handling for addAutomaticRedirect in Taxon & Product Form Ensure that the addAutomaticRedirect variable is set to null if it does not exist in the form structure. This prevents potential errors when accessing the variable while creating a new Taxon or Product. --- src/Twig/EventSubscriber/ProductFormComponentSubscriber.php | 2 +- src/Twig/EventSubscriber/TaxonFormComponentSubscriber.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Twig/EventSubscriber/ProductFormComponentSubscriber.php b/src/Twig/EventSubscriber/ProductFormComponentSubscriber.php index 6a41daa..e78f067 100644 --- a/src/Twig/EventSubscriber/ProductFormComponentSubscriber.php +++ b/src/Twig/EventSubscriber/ProductFormComponentSubscriber.php @@ -45,7 +45,7 @@ public function onPreRender(PreRenderEvent $event): void return; } - $addAutomaticRedirect = $vars['form']->children['translations']->children[$localeCode]->children['addAutomaticRedirect']; + $addAutomaticRedirect = $vars['form']->children['translations']->children[$localeCode]->children['addAutomaticRedirect'] ?? null; if (!$addAutomaticRedirect instanceof FormView) { return; } diff --git a/src/Twig/EventSubscriber/TaxonFormComponentSubscriber.php b/src/Twig/EventSubscriber/TaxonFormComponentSubscriber.php index 17edbab..d98ef7c 100644 --- a/src/Twig/EventSubscriber/TaxonFormComponentSubscriber.php +++ b/src/Twig/EventSubscriber/TaxonFormComponentSubscriber.php @@ -45,7 +45,7 @@ public function onPreRender(PreRenderEvent $event): void return; } - $addAutomaticRedirect = $vars['form']->children['translations']->children[$localeCode]->children['addAutomaticRedirect']; + $addAutomaticRedirect = $vars['form']->children['translations']->children[$localeCode]->children['addAutomaticRedirect'] ?? null; if (!$addAutomaticRedirect instanceof FormView) { return; }