diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index d469213d2..dab06769f 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -966,6 +966,8 @@ class Controller extends Object { if (isset($this->data[$modelClass][$field . $var])) { if (!empty($this->data[$modelClass][$field . $var])) { $time[$var] = $this->data[$modelClass][$field . $var]; + } elseif ($this->data[$modelClass][$field . $var] === '0') { + $time[$var] = '00'; } $useNewDate = true; unset($this->data[$modelClass][$field . $var]); @@ -1107,7 +1109,7 @@ class Controller extends Object { } else { $count = $object->findCount($conditions, $recursive); } - $pageCount = ceil($count / $limit); + $pageCount = intval(ceil($count / $limit)); if ($page == 'last') { $options['page'] = $page = $pageCount; diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index c93f2644c..6474cb504 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -119,6 +119,15 @@ class ControllerTest extends CakeTestCase { $expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40')); $this->assertEqual($Controller->data, $expected); + $Controller->data['ControllerPost']['created_hour'] = '13'; + $Controller->data['ControllerPost']['created_min'] = '0'; + $Controller->data['ControllerPost']['updated_hour'] = '14'; + $Controller->data['ControllerPost']['updated_min'] = '40'; + + $Controller->cleanUpFields(); + $expected = array('ControllerPost'=> array('created'=> '13:00', 'updated'=> '14:40')); + $this->assertEqual($Controller->data, $expected); + unset($Controller); }