diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index bc992ceb5..8b52a31b6 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1386,7 +1386,7 @@ class Model extends Overloadable { $offset = ($page - 1) * $limit; } - if ($order == null) { + if ($order == null && $order !== false) { if ($this->order == null) { $order = array(); } else { @@ -1495,7 +1495,7 @@ class Model extends Overloadable { * @see Model::findAll */ function findCount($conditions = null, $recursive = 0) { - list($data) = $this->findAll($conditions, 'COUNT(*) AS count', $this->escapeField(), null, 1, $recursive); + list($data) = $this->findAll($conditions, 'COUNT(*) AS count', false, null, 1, $recursive); if (isset($data[0]['count'])) { return $data[0]['count']; diff --git a/cake/libs/router.php b/cake/libs/router.php index 79e3bdafa..bf913078a 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -768,7 +768,6 @@ class Router extends Object { */ if(!function_exists('http_build_query')) { function http_build_query($data, $prefix = null, $argSep = null, $baseKey = null) { - //die('?'); if(empty($argSep)) { $argSep = ini_get('arg_separator.output'); } diff --git a/cake/tests/cases/libs/model/model.test.php b/cake/tests/cases/libs/model/model.test.php index 1ee6df746..5a0fa8647 100644 --- a/cake/tests/cases/libs/model/model.test.php +++ b/cake/tests/cases/libs/model/model.test.php @@ -383,14 +383,25 @@ class ModelTest extends CakeTestCase { )) ); $this->assertEqual($result, $expected); - - /* - $result = $this->model->hasMany; - $expected = array(); - $this->assertEqual($result, $expected); - */ } - + + function testFindCount() { + $this->model =& new User(); + $result = $this->model->findCount(); + $this->assertEqual($result, 4); + + $this->db->fullDebug = true; + $this->model->order = 'User.id'; + $result = $this->model->findCount(); + $this->assertEqual($result, 4); + + $this->assertTrue(isset($this->db->_queriesLog[0]['query'])); + $this->assertNoPattern('/ORDER\s+BY/', $this->db->_queriesLog[0]['query']); + + $this->db->_queriesLog = array(); + $this->db->fullDebug = false; + } + function testFindMagic() { $this->model =& new User();