Merge pull request #2427 from EliuFlorez/patch-3

Cast implemented events to an array when detaching listeners.

This makes it much simpler to work with mocks, and avoids warnings caused by developer error.
This commit is contained in:
Mark Story 2013-12-04 11:26:35 -08:00
commit 58317d312c

View file

@ -197,7 +197,7 @@ class CakeEventManager {
* @return void
*/
protected function _detachSubscriber(CakeEventListener $subscriber, $eventKey = null) {
$events = $subscriber->implementedEvents();
$events = (array)$subscriber->implementedEvents();
if (!empty($eventKey) && empty($events[$eventKey])) {
return;
} elseif (!empty($eventKey)) {