diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 3a908f5df..4ae591015 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -3302,8 +3302,12 @@ class Model extends Object implements CakeEventListener { */ public function isUnique($fields, $or = true) { if (is_array($or)) { - $isAssociative = count(array_filter(array_keys($or), 'is_string')); - if (!$isAssociative) { + $isRule = ( + array_key_exists('rule', $or) && + array_key_exists('required', $or) && + array_key_exists('message', $or) + ); + if (!$isRule) { $args = func_get_args(); $fields = $args[1]; $or = isset($args[2]) ? $args[2] : true; diff --git a/lib/Cake/Test/Case/Model/ModelValidationTest.php b/lib/Cake/Test/Case/Model/ModelValidationTest.php index 270d61119..e25f87897 100644 --- a/lib/Cake/Test/Case/Model/ModelValidationTest.php +++ b/lib/Cake/Test/Case/Model/ModelValidationTest.php @@ -2450,7 +2450,7 @@ class ModelValidationTest extends BaseModelTest { } /** - * Test backward compatibility of the isUnique method when used as a validator for multiple fields. + * Test backward compatibility of the isUnique method when used as a validator for a single field. * * @return void */