Closed
Description
Symfony version(s) affected: 3.4.x-dev (from #29411)
Description
TraceableEventDispatcher was rewritten to use callStack as SplObjectStorage instead of array, but #reset() still assigns callStack to array(), which throws error at line 268 with 'Call to a member function attach() on array' on next call to dispatch().
How to reproduce
Just grab the TraceableEventDispatcher, call reset(), and call dispatch() on anything.
<?php
class BugReproduceTest extends \Codeception\Test\Unit
{
/**
* @group repro
*/
public function testReproduce()
{
$dispatcher = $this->getModule( 'Symfony' )->grabService( 'debug.event_dispatcher' );
$dispatcher->reset();
$dispatcher->dispatch( 'kernel.request' );
}
}
Possible Solution
Suggest a simple change
from (starting line 222):
public function reset()
{
$this->callStack = array();
}
to (starting line 222)
public function reset()
{
$this->callStack = new \SplObjectStorage();
}
Additional context
N/A