Permalink
Browse files

Fixing issue in DboSource::_matchRecords() where unqualified conditio…

…ns would result in 1=1 conditions. Fixing incorrect test case. Fixes #930
  • Loading branch information...
1 parent 285876c commit 5a8648cca068821fb601fa3c1756dc721437078b @markstory markstory committed Sep 16, 2010
@@ -1689,8 +1689,10 @@ function _matchRecords(&$model, $conditions = null) {
$noJoin = false;
break;
}
- $conditions[$field] = $value;
- unset($conditions[$originalField]);
+ if ($field !== $originalField) {
+ $conditions[$field] = $value;
+ unset($conditions[$originalField]);
+ }
}
if ($noJoin === true) {
return $this->conditions($conditions);
@@ -834,13 +834,13 @@ function testQuoteDistinctInFunction() {
function testUpdateAllWithNonQualifiedConditions() {
$this->loadFixtures('Article');
$Article =& new Article();
- $result = $Article->updateAll(array('title' => "'Awesome'"), array('published' => 'Y'));
+ $result = $Article->updateAll(array('title' => "'Awesome'"), array('title' => 'Third Article'));
$this->assertTrue($result);
$result = $Article->find('count', array(
'conditions' => array('Article.title' => 'Awesome')
));
- $this->assertEqual($result, 3, 'Article count is wrong or fixture has changed.');
+ $this->assertEqual($result, 1, 'Article count is wrong or fixture has changed.');
}
/**

0 comments on commit 5a8648c

Please sign in to comment.