diff --git a/cake/libs/set.php b/cake/libs/set.php index 8cf170b62..e12c877d4 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -487,6 +487,9 @@ class Set extends Object { continue; } list(,$key,$op,$expected) = $match; + if (!isset($data[$key])) { + return false; + } $val = $data[$key]; if ($op == '=' && $val != $expected) { return false; diff --git a/cake/tests/cases/libs/set.test.php b/cake/tests/cases/libs/set.test.php index a5404e98b..ffc6172c9 100644 --- a/cake/tests/cases/libs/set.test.php +++ b/cake/tests/cases/libs/set.test.php @@ -470,6 +470,13 @@ class SetTest extends UnitTestCase { 'text' => 'Comment 5', ), ), + ), + array( + 'Article' => array( + 'id' => 3, + 'name' => 'Article 3', + ), + 'Comment' => array(), ) );