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
The issue was fixed for private properties, but public properties are still falling in the first condition, and being set as null when deleting an entity.
The text was updated successfully, but these errors were encountered:
… untyped ones
Due to how PHP 7.4 works, if you have a typed public property that does not support null values, whenever Doctrine tries to delete an entity with such properties,
it raises a TypeError. This happens because of the new default "uninitialized" value for typed properties. In previous versions of PHP, the default uninitialized value was null.
My fist idea was to just reverse the order, and while that worked, it introduced a BC break.
Now, as per @guilliamxavier suggestion, I've moved the methods from the class TypedNoDefaultRuntimePublicReflectionProperty to
a trait, then I proceeded to create a new class extending RuntimePublicReflectionProperty, that uses the new trait.
With this, whenever Doctrine tries to access a public property with no default value set, it will properly unset the property instead of setting it as null getting a PHP TypeError.
Reordered property type resolution so typed properties get resolved first, added tests for covering multiple scenarios
Fixesdoctrine#102Fixesdoctrine/orm#7999
Co-authored-by: Guilliam Xavier <guilliamxavier@users.noreply.github.com>
persistence/lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php
Line 77 in f5cf0d5
Related to: doctrine/orm#7999
The issue was fixed for private properties, but public properties are still falling in the first condition, and being set as null when deleting an entity.
The text was updated successfully, but these errors were encountered: