diff --git a/src/LiveComponent/src/ComponentWithFormTrait.php b/src/LiveComponent/src/ComponentWithFormTrait.php index c8ab525d495..a8376777c1a 100644 --- a/src/LiveComponent/src/ComponentWithFormTrait.php +++ b/src/LiveComponent/src/ComponentWithFormTrait.php @@ -261,14 +261,13 @@ private function extractFormValues(FormView $formView): array continue; } - if (\array_key_exists('choices', $child->vars) + if (\array_key_exists('choices', $child->vars) && $child->vars['choices'] && $child->vars['required'] && !$child->vars['disabled'] && !$child->vars['value'] - && (false === $child->vars['placeholder'] || null === $child->vars['placeholder']) - && !$child->vars['multiple'] - && !$child->vars['expanded'] - && $child->vars['choices'] + && \array_key_exists('placeholder', $child->vars) && (false === $child->vars['placeholder'] || null === $child->vars['placeholder']) + && \array_key_exists('multiple', $child->vars) && !$child->vars['multiple'] + && \array_key_exists('expanded', $child->vars) && !$child->vars['expanded'] ) { if (null !== $firstKey = array_key_first($child->vars['choices'])) { $values[$name] = $child->vars['choices'][$firstKey]->value ?? null;