You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found an issue on symfony/serializer. I was trying to denormalize an array into an object which have an id property with types int|null|false.
The error displayed is :
Error: Call to undefined function is_false()
vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:780
vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:380
(I also have the same error for mixed type: “Call to undefined function is_mixed()“)
Here is the test to reproduce it:
<?phpuseSymfony\Component\Serializer\Tests\Php80Dummy;
publicfunctiontestDenormalizeFalsePseudoTypeButSetAString(): void
{
// given a serializer that extracts the attribute types of an object via ReflectionExtractor$propertyTypeExtractor = newPropertyInfoExtractor([], [newReflectionExtractor()], [], [], []);
$objectNormalizer = newObjectNormalizer(null, null, null, $propertyTypeExtractor);
$serializer = newSerializer([$objectNormalizer]);
// when denormalizing some data into an object where an attribute uses the false pseudo type/** @var Php80Dummy $object */$object = $serializer->denormalize(['canBeFalseOrString' => 'aString'], Php80Dummy::class);
// then the attribute that declared false was filled correctly$this->assertEquals('aString', $object->canBeFalseOrString);
}
<?phpuseSymfony\Component\Serializer\Tests\Php80Dummy;
publicfunctiontestDenormalizeFalsePseudoTypeButSetAString(): void
{
// given a serializer that extracts the attribute types of an object via ReflectionExtractor$propertyTypeExtractor = newPropertyInfoExtractor([], [newReflectionExtractor()], [], [], []);
$objectNormalizer = newObjectNormalizer(null, null, null, $propertyTypeExtractor);
$serializer = newSerializer([$objectNormalizer]);
// when denormalizing some data into an object where an attribute uses the false pseudo type/** @var Php80Dummy $object */$object = $serializer->denormalize(['canBeFalseOrString' => 'aString'], Php80Dummy::class);
// then the attribute that declared false was filled correctly$this->assertEquals('aString', $object->canBeFalseOrString);
}
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected
7.1.0
Description
I found an issue on
symfony/serializer
. I was trying to denormalize anarray
into anobject
which have anid
property with typesint|null|false
.The error displayed is :
(I also have the same error for mixed type: “Call to undefined function is_mixed()“)
Here is the test to reproduce it:
I simply changed the array value from false to 'aString' in this existing PHPUnit test :
https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php#L768-L782
How to reproduce
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: