瀏覽代碼

[EventDispatcher] fixed possible PHP warning

Fabien Potencier 15 年之前
父節點
當前提交
2b8dfe1ccf
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/Symfony/Component/EventDispatcher/EventDispatcher.php

+ 3 - 0
src/Symfony/Component/EventDispatcher/EventDispatcher.php

@@ -31,6 +31,9 @@ class EventDispatcher
     public function connect($name, $listener, $priority = 0)
     {
         if (!isset($this->listeners[$name][$priority])) {
+            if (!isset($this->listeners[$name])) {
+                $this->listeners[$name] = array();
+            }
             $this->listeners[$name][$priority] = array();
         }