[PR #8483] Fix single scalar hydrator memory leak on exception #11015

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

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

State: closed
Merged: Yes


Resolves #8482, Closes https://github.com/doctrine/orm/pull/7315

I have encountered an issue with a memory leak in SingleScalarHydrator.

AbstractHydrator::hydrateAll() method does not take into account the possibility of an exception being thrown so when SingleScalarHydrator::hydrateAllData throws NoResultException/NonUniqueResultException, the event listener for onClear event is not removed and the hydrator is stuck in the memory.

It's been solved here once but not merged due to missing test cases.

Original issue: Fix memory leak in AbstractHydrator

I'll try to provide a fix and appropriate test case for this issue so it can be finally merged.

**Original Pull Request:** https://github.com/doctrine/orm/pull/8483 **State:** closed **Merged:** Yes --- Resolves #8482, Closes https://github.com/doctrine/orm/pull/7315 > I have encountered an issue with a memory leak in SingleScalarHydrator. > > AbstractHydrator::hydrateAll() method does not take into account the possibility of an exception being thrown so when SingleScalarHydrator::hydrateAllData throws NoResultException/NonUniqueResultException, the event listener for onClear event is not removed and the hydrator is stuck in the memory. > > It's been solved here once but not merged due to missing test cases. > > Original issue: Fix memory leak in AbstractHydrator > > I'll try to provide a fix and appropriate test case for this issue so it can be finally merged.
admin added the pull-request label 2026-01-22 16:09:26 +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#11015