DDC-1173: Fatal error when a listener resets an object in onFlush and recompute the changeset #1474

Closed
opened 2026-01-22 13:15:29 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (May 26, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user stof:

When a listener resets an entity during onFlush and recompute the changeset (setting it to null as there is no changes), the following triggering of preUpdate fails as PreUpdateEventArgs would get null as third argument which is forbidden

Originally created by @doctrinebot on GitHub (May 26, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user stof: When a listener resets an entity during onFlush and recompute the changeset (setting it to null as there is no changes), the following triggering of preUpdate fails as PreUpdateEventArgs would get null as third argument which is forbidden
admin added the Bug label 2026-01-22 13:15:29 +01:00
admin closed this issue 2026-01-22 13:15:29 +01:00
Author
Owner

@doctrinebot commented on GitHub (May 30, 2011):

Comment created by gediminasm:

Here is a test case:

use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Event\OnFlushEventArgs;

class DummyListener implements EventSubscriber
{
public function getSubscribedEvents()
{
return array('preUpdate', 'onFlush');
}

public function onFlush(OnFlushEventArgs $args)
{
    $uow = $args->getEntityManager()->getUnitOfWork();
    foreach ($uow->getScheduledEntityUpdates() as $object) {
        $uow->clearEntityChangeSet(spl*object*hash($object));
    }
}

public function preUpdate(PreUpdateEventArgs $args)
{
    var_dump('invoked');
}

}

triggers fatal error

@doctrinebot commented on GitHub (May 30, 2011): Comment created by gediminasm: Here is a test case: use Doctrine\Common\EventSubscriber; use Doctrine\ORM\Event\PreUpdateEventArgs; use Doctrine\ORM\Event\OnFlushEventArgs; class DummyListener implements EventSubscriber { public function getSubscribedEvents() { return array('preUpdate', 'onFlush'); } ``` public function onFlush(OnFlushEventArgs $args) { $uow = $args->getEntityManager()->getUnitOfWork(); foreach ($uow->getScheduledEntityUpdates() as $object) { $uow->clearEntityChangeSet(spl*object*hash($object)); } } public function preUpdate(PreUpdateEventArgs $args) { var_dump('invoked'); } ``` } triggers fatal error
Author
Owner

@doctrinebot commented on GitHub (Jun 5, 2011):

Comment created by @beberlei:

Only fixed in 2.1

@doctrinebot commented on GitHub (Jun 5, 2011): Comment created by @beberlei: Only fixed in 2.1
Author
Owner

@doctrinebot commented on GitHub (Jun 5, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jun 5, 2011): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1474