diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 3952ad5c3..0848c0762 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -3315,9 +3315,10 @@ class Model extends Object implements CakeEventListener { } if (!is_array($fields)) { $fields = func_get_args(); - if (is_bool($fields[count($fields) - 1])) { - $or = $fields[count($fields) - 1]; - unset($fields[count($fields) - 1]); + $fieldCount = count($fields) - 1; + if (is_bool($fields[$fieldCount])) { + $or = $fields[$fieldCount]; + unset($fields[$fieldCount]); } }