[PR #6004] Fix hydration in a joined inheritance with simple array or json array #9814

Open
opened 2026-01-22 16:05:29 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6004

State: closed
Merged: No


Both SimpleArrayType and JsonArrayType convert the value null to an empty array, which fails the null check that is used to prevent overwrite (in https://github.com/doctrine/doctrine2/blob/v2.5.4/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php#L134).
Fixes issue #5989

It could be debated that the issue is actually with the types that convert null to something else (especially since ArrayType actually returns null when the value is null). But changing them would be a BC break so I think it is a separate issue. Also, there is no way to know how custom types will convert null values, so it seems like a reasonable approach to check for null before the conversion since it's quite a serious bug to overwrite data in the hydrator.

**Original Pull Request:** https://github.com/doctrine/orm/pull/6004 **State:** closed **Merged:** No --- Both SimpleArrayType and JsonArrayType convert the value `null` to an empty array, which fails the null check that is used to prevent overwrite (in https://github.com/doctrine/doctrine2/blob/v2.5.4/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php#L134). Fixes issue #5989 It could be debated that the issue is actually with the types that convert null to something else (especially since ArrayType actually returns null when the value is null). But changing them would be a BC break so I think it is a separate issue. Also, there is no way to know how custom types will convert null values, so it seems like a reasonable approach to check for null before the conversion since it's quite a serious bug to overwrite data in the hydrator.
admin added the pull-request label 2026-01-22 16:05:29 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9814