From e6f2c92005cfb5850159621da182f9b4f327fdd2 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 3 Dec 2013 22:39:14 -0500 Subject: [PATCH] Cast results of implementedEvents to an array. This makes using mocks much easier with event listeners as they don't need to provide a returnValue for implementedEvents. Refs #2333 --- lib/Cake/Event/CakeEventManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Event/CakeEventManager.php b/lib/Cake/Event/CakeEventManager.php index 77d283e76..3d6bf94f3 100644 --- a/lib/Cake/Event/CakeEventManager.php +++ b/lib/Cake/Event/CakeEventManager.php @@ -122,7 +122,7 @@ class CakeEventManager { * @return void */ protected function _attachSubscriber(CakeEventListener $subscriber) { - foreach ($subscriber->implementedEvents() as $eventKey => $function) { + foreach ((array)$subscriber->implementedEvents() as $eventKey => $function) { $options = array(); $method = $function; if (is_array($function) && isset($function['callable'])) {