Jelajahi Sumber

merged branch jmikola/ContainerAwareEventDispatcher-key-conflict (PR #2022)

Commits
-------

84c1719 [FrameworkBundle] Avoid listener key conflicts in ContainerAwareEventDispatcher

Discussion
----------

[FrameworkBundle] Avoid listener key conflicts in ContainerAwareEventDispatcher

Since the key was previously concatenating service ID and method without a separator, it's possible that two different listeners could conflict (e.g. service/method pairs: foo/bar and fo/obar).
Fabien Potencier 13 tahun lalu
induk
melakukan
7f2c4ab557

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php

@@ -86,7 +86,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
                 list($serviceId, $method, $priority) = $args;
                 $listener = $this->container->get($serviceId);
 
-                $key = $serviceId.$method;
+                $key = $serviceId.'.'.$method;
                 if (!isset($this->listeners[$eventName][$key])) {
                     $this->addListener($eventName, array($listener, $method), $priority);
                 } elseif ($listener !== $this->listeners[$eventName][$key]) {