[PR #989] [CLOSED] Fix the problem when the lifecycle event can be triggered more then once... #9002

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

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/989
Author: @dyangrev
Created: 3/26/2014
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • 26692f1 Fix the problem when the lifecycle event can be triggered more then once incorrectly

📊 Changes

1 file changed (+12 additions, -0 deletions)

View changed files

📝 lib/Doctrine/ORM/UnitOfWork.php (+12 -0)

📄 Description

We recently saw the postUpdate event get trigger multiple time incorrectly, it typically happens when flushing a set of entities persisted whose listener persist and flush another type of entity in it.

Php passes variables to foreach by value, for the function executeUpdates in the UnitOfWork, for example, entities in the $this->entityUpdates could be updated and unset in the listener of the first entity, while them will be updated and trigger listeners again when the process of first entity finishes (although they have already been unset from $this->entityUpdates). Similar for executeInsertion and executeDeletion.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/989 **Author:** [@dyangrev](https://github.com/dyangrev) **Created:** 3/26/2014 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`26692f1`](https://github.com/doctrine/orm/commit/26692f1a810d3939229a2107f4f3da138166bbd7) Fix the problem when the lifecycle event can be triggered more then once incorrectly ### 📊 Changes **1 file changed** (+12 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/UnitOfWork.php` (+12 -0) </details> ### 📄 Description We recently saw the postUpdate event get trigger multiple time incorrectly, it typically happens when flushing a set of entities persisted whose listener persist and flush another type of entity in it. Php passes variables to foreach by value, for the function executeUpdates in the UnitOfWork, for example, entities in the $this->entityUpdates could be updated and unset in the listener of the first entity, while them will be updated and trigger listeners again when the process of first entity finishes (although they have already been unset from $this->entityUpdates). Similar for executeInsertion and executeDeletion. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:02:44 +01:00
admin closed this issue 2026-01-22 16:02:44 +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#9002