diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index 9eceb725a..82800818a 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -305,7 +305,7 @@ class TranslateBehavior extends ModelBehavior { } } else { $value = ''; - if (is_numeric($row[$Model->alias][$aliasVirtual]) || !empty($row[$Model->alias][$aliasVirtual])) { + if (isset($row[$Model->alias][$aliasVirtual])) { $value = $row[$Model->alias][$aliasVirtual]; } $row[$Model->alias][$aliasField] = $value; diff --git a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php index c660053ac..888ffeb79 100644 --- a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php +++ b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php @@ -285,7 +285,9 @@ class TranslateBehaviorTest extends CakeTestCase { $TestModel = new TranslatedItem(); $TestModel->locale = 'eng'; - $result = $TestModel->find('all', array('conditions' => array('slug' => 'first_translated'))); + $result = $TestModel->find('all', array( + 'conditions' => array('slug' => 'first_translated') + )); $expected = array( array( 'TranslatedItem' => array( @@ -300,10 +302,12 @@ class TranslateBehaviorTest extends CakeTestCase { ); $this->assertEquals($expected, $result); - $result = $TestModel->find('count', array('conditions' => "TranslatedItem.slug = 'first_translated'")); + $result = $TestModel->find('count', array( + 'conditions' => array('slug' => 'first_translated') + )); $expected = 1; $this->assertEquals($expected, $result); - } + } /** * testLocaleSingleAssociations method