Wasted over two hours today on a stupid bug: for some reason, every event was handled two times on my local machine.

Why? Because although all services are readonly after instantiation, the EventDispatcher isn't: it is modified when registering event handlers. Meaning the very same instance of the actual EventSubscriber was reused for the async- and sync event dispatcher. Which are just simple wrappers for primary and secondary use cases, but use the _same_ instance of the actual EventSubscriber in my dev-environment as I now know.

Thankfully a shallow clone did the trick. Of course it would be possible to simply create a new instance, but this is one of the few services which are autoconfigured by the framework.

Don't know what to make of this to be honest. "Play stupid games, win stupid prizes!" I guess...

Add Comment