[PR #9663] ScalarColumnHydrator: prevent early-bail on falsy values #11782

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

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

State: closed
Merged: Yes


Hi !

This is my first contribution to Doctrine, please let me know if there is anything I can do to facilitate the review process.

--

Fix #9230

Falsy values stop the hydration process in $query->getSingleColumnResult(). If the array of values fetched from the database contains a value that is "falsy", every value after that value and including that value is missing from the array that is returned.

This is because of the way the database values are retreived in ScalarColumnHydrator : f4d5283f70/lib/Doctrine/ORM/Internal/Hydration/ScalarColumnHydrator.php (L31-L33)

This PR fixes that by fetching all the values and returning them as is. As before, and to keep things consistent with the previous behavior of both ScalarHydrator and ScalarColumnHydrator, no type conversion is done between the database value and the PHP value. According to a comment in AbstractHydrator, this is the expected behavior for scalar hydrators that is a legacy behavior from 2.0 : f4d5283f70/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php (L498-L505)

**Original Pull Request:** https://github.com/doctrine/orm/pull/9663 **State:** closed **Merged:** Yes --- Hi ! This is my first contribution to Doctrine, please let me know if there is anything I can do to facilitate the review process. -- Fix #9230 Falsy values stop the hydration process in `$query->getSingleColumnResult()`. If the array of values fetched from the database contains a value that is "falsy", every value after that value and including that value is missing from the array that is returned. This is because of the way the database values are retreived in ScalarColumnHydrator : https://github.com/doctrine/orm/blob/f4d5283f705f6ac51e81c8299ace074a619b40d7/lib/Doctrine/ORM/Internal/Hydration/ScalarColumnHydrator.php#L31-L33 This PR fixes that by fetching all the values and returning them as is. As before, and to keep things consistent with the previous behavior of both ScalarHydrator and ScalarColumnHydrator, no type conversion is done between the database value and the PHP value. According to a comment in `AbstractHydrator`, this is the expected behavior for scalar hydrators that is a legacy behavior from 2.0 : https://github.com/doctrine/orm/blob/f4d5283f705f6ac51e81c8299ace074a619b40d7/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php#L498-L505
admin added the pull-request label 2026-01-22 16:11:54 +01:00
admin closed this issue 2026-01-22 16:11:55 +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#11782