minor #15825 Fix potential access to undefined index (Seldaek)
This PR was merged into the 2.8 branch.
Discussion
----------
Fix potential access to undefined index
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Fixes @tobion's comment in https://github.com/symfony/symfony/pull/14563/files#r39705270
Commits
-------
de41002
Fix potential access to undefined index
This commit is contained in:
commit
45b2382f46
@ -55,7 +55,11 @@ class EventDispatcher implements EventDispatcherInterface
|
|||||||
public function getListeners($eventName = null, $withPriorities = false)
|
public function getListeners($eventName = null, $withPriorities = false)
|
||||||
{
|
{
|
||||||
if (true === $withPriorities) {
|
if (true === $withPriorities) {
|
||||||
return $eventName ? $this->listeners[$eventName] : array_filter($this->listeners);
|
if (null !== $eventName) {
|
||||||
|
return isset($this->listeners[$eventName]) ? $this->listeners[$eventName] : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_filter($this->listeners);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $eventName) {
|
if (null !== $eventName) {
|
||||||
|
Reference in New Issue
Block a user