mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Bug: UnitOfWork refresh attempts to load the wrong object #7333
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Novynn on GitHub (Mar 2, 2024).
Bug Report
Summary
When calling refresh on an entity, under certain circumstances the id used to fetch the entity from the database can be wrong.
Current behavior
Confusing the
UnitOfWorkby creating a new entity with the same id as one that it is already being managed can cause OID collisions when that entity is garbage collected due to not having a reference in theUnitOfWork'sidentityMap. This leads to arefreshattempting to use the wrong id in the database.How to reproduce
Output:
Expected behavior
In the future the exception in #10785 will be thrown, but currently the code continues as normal in a broken state until the mismatched column types stop execution.