diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index dedd6d57d..1c70162cf 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -1567,7 +1567,7 @@ class DboSource extends DataSource { $data = $this->name($key) . " = " . $this->boolean($value); } elseif ($value === '') { $data = $this->name($key) . " = ''"; - } elseif (preg_match('/^([a-z]*\\([a-z0-9]*\\)\\x20?|(?:' . join('\\x20)|(?:', $this->__sqlOps) . '\\x20)|<=?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)?(.*)/i', $value, $match)) { + } elseif (preg_match('/^([a-z]*\\([a-z0-9]*\\)\\x20?|(?:' . join('\\x20)|(?:', $this->__sqlOps) . '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)?(.*)/i', $value, $match)) { if (preg_match('/(\\x20[\\w]*\\x20)/', $key, $regs)) { $clause = $regs['1']; $key = preg_replace('/' . $regs['1'] . '/', '', $key); diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index f41678ec6..886d7e753 100644 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -1377,6 +1377,13 @@ class DboSourceTest extends UnitTestCase { 'Enrollment.yearcompleted' => '> 0') ); $this->assertPattern('/^\s*WHERE\s+NOT\s+\(`Course`\.`id` IS NULL\)\s+AND NOT\s+\(`Course`\.`vet`\s+=\s+\'N\'\)\s+AND NOT\s+\(`level_of_education_id` IN \(912, 999\)\s*\)\s+AND\s+`Enrollment`\.`yearcompleted`\s+>\s+0\s*$/', $result); + + $result = $this->db->conditions(array('id' => '<> 8')); + $this->assertPattern('/^\s*WHERE\s+`id`\s+<>\s+8\s*$/', $result); + + //$result = $this->db->conditions(array('TestModel.field' => '= gribe$@()lu')); + //$expected = " WHERE `TestModel.field` = 'gribe$@()lu'"; + //$this->assertEqual($result, $expected); } function testFieldParsing() {