[PR #11795] Introduce testNotListedValueInEnumArray #13270

Closed
opened 2026-01-22 16:16:41 +01:00 by admin · 0 comments
Owner

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

State: closed
Merged: No


Add a test that failed to highlight the error described in #11796

Using a json column with enumType, if the database contains a value that is not in enum, so an exception is thrown AbstractHydrator::buildEnum then converted to another exception in SimpleObjectHydrator. During this conversion, the original value is casted into string. In case of array of enum (json or simple array), $originalValue contains an array of string that can not be casted to string. So we got the "Array to string conversion" error instead of a proper error about a case not listed in the enum.

**Original Pull Request:** https://github.com/doctrine/orm/pull/11795 **State:** closed **Merged:** No --- Add a test that failed to highlight the error described in #11796 > Using a json column with enumType, if the database contains a value that is not in enum, so an exception is thrown `AbstractHydrator::buildEnum` then converted to another exception in SimpleObjectHydrator. During this conversion, [the original value is casted into string](https://github.com/doctrine/orm/blob/3.3.x/src/Internal/Hydration/SimpleObjectHydrator.php#L148). In case of array of enum (json or simple array), `$originalValue` contains an array of string that can not be casted to string. So we got the "Array to string conversion" error instead of a proper error about a case not listed in the enum.
admin added the pull-request label 2026-01-22 16:16:41 +01:00
admin closed this issue 2026-01-22 16:16:41 +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#13270