Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Closed
Description
Symfony version(s) affected
5.3.11
Description
<?phpnamespaceApp\Validator;useSymfony\Component\Validator\Constraint;#[\Attribute(\Attribute::TARGET_CLASS)]class Foobarextends Constraint{publicfunction__construct(publicbool$something, ) { }publicfunctiongetTargets() {returnself::CLASS_CONSTRAINT; }}
- With SF 5.3.10, the following code works property
- With SF 5.3.11, it fails
- error:
TypeError {#83 #message: "in_array(): Argument #2 ($haystack) must be of type array, null given" #code: 0 #file: "./vendor/symfony/validator/Constraint.php" #line: 238 trace: { ./vendor/symfony/validator/Constraint.php:238 { …} ./vendor/symfony/validator/Mapping/ClassMetadata.php:222 { …} ./vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php:52 { …} ./vendor/symfony/validator/Mapping/Loader/LoaderChain.php:54 { …} ./vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php:101 { …} ./vendor/symfony/validator/Validator/RecursiveContextualValidator.php:306 { …} ./vendor/symfony/validator/Validator/RecursiveContextualValidator.php:138 { …} ./vendor/symfony/validator/Validator/RecursiveValidator.php:93 { …} ./vendor/symfony/validator/Validator/TraceableValidator.php:66 { …} ./reproducer.php:18 { › $v = $k->getContainer()->get('validator'); › $error = $v->validate(new Dto()); › } }}
- to make it work, I have to call the parent constructor
How to reproduce
I made a full reproducer here:https://github.com/lyrixx/test/commits/custom-validator