From 7539abca79191ea81fa4879345490d34f5dbbff1 Mon Sep 17 00:00:00 2001 From: Matt Alexander Date: Sun, 17 Jul 2011 18:18:08 -0600 Subject: [PATCH] Normalize variable type Make sure $query['conditions'] is an array in beforeFind() callback, so as to avoid a PHP warning when using array_keys() --- models/behaviors/habtamable.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/models/behaviors/habtamable.php b/models/behaviors/habtamable.php index bc7773a..cfe5d00 100755 --- a/models/behaviors/habtamable.php +++ b/models/behaviors/habtamable.php @@ -52,6 +52,9 @@ public function beforeFind(&$Model, $query) { * and implode the keys it into a string. */ private function checkHabtmConditions($Model, $query) { + if (empty($query['conditions'])) { + $query['conditions'] = array(); + } $searchableConditions = implode('.', Set::flatten(array_keys($query['conditions']))); return (bool) strpos($searchableConditions, $this->settings[$Model->alias]['habtmModel']);