Skip to content

Conversation

@yoeunes
Copy link
Contributor

@yoeunes yoeunes commented Nov 21, 2025

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

When using EnumNode with a BackedEnum (via enumFqcn) and explicitly allowing null values (e.g. ->defaultNull()), the finalization logic incorrectly throws an InvalidConfigurationException:

"Only strings and integers can be cast to a case of the "Symfony\Component\Config\Tests\Fixtures\StringBackedTestEnum" enum, got value of type "null""

$rootNode
    ->children()
        ->enumNode('status')
            ->enumFqcn(StringBackedTestEnum::class)
            ->defaultNull() // Now correctly allows null in config
        ->end()
    ->end()
;

@nicolas-grekas
Copy link
Member

Thank you @yoeunes.

@nicolas-grekas nicolas-grekas merged commit 63510b9 into symfony:7.3 Nov 24, 2025
11 checks passed
@fabpot fabpot mentioned this pull request Nov 27, 2025
This was referenced Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants