diff --git a/lib/Cake/Controller/CakeErrorController.php b/lib/Cake/Controller/CakeErrorController.php index 6131bcb14..577864881 100644 --- a/lib/Cake/Controller/CakeErrorController.php +++ b/lib/Cake/Controller/CakeErrorController.php @@ -54,12 +54,15 @@ class CakeErrorController extends AppController { $this->components[] = 'RequestHandler'; } $this->constructClasses(); + if ($this->Components->enabled('Auth')) { + $this->Components->disable('Auth'); + } + if ($this->Components->enabled('Security')) { + $this->Components->disable('Security'); + } $this->startupProcess(); $this->_set(array('cacheAction' => false, 'viewPath' => 'Errors')); - if (isset($this->RequestHandler)) { - $this->RequestHandler->startup($this); - } } /** diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index 35b7ccc7f..311b95a6c 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -264,10 +264,6 @@ class AuthComponent extends Component { * @return boolean */ public function startup(Controller $controller) { - if ($controller->name == 'CakeError') { - return true; - } - $methods = array_flip(array_map('strtolower', $controller->methods)); $action = strtolower($controller->request->params['action']); diff --git a/lib/Cake/Controller/Component/SecurityComponent.php b/lib/Cake/Controller/Component/SecurityComponent.php index cb842deeb..1a2043895 100644 --- a/lib/Cake/Controller/Component/SecurityComponent.php +++ b/lib/Cake/Controller/Component/SecurityComponent.php @@ -206,10 +206,6 @@ class SecurityComponent extends Component { * @return void */ public function startup(Controller $controller) { - if ($controller->name == 'CakeError') { - return true; - } - $this->request = $controller->request; $this->_action = $this->request->params['action']; $this->_methodsRequired($controller); diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 6e745a3c2..a6692cfe4 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -2370,13 +2370,14 @@ class Model extends Object implements CakeEventListener { break; } } - - $keys = $this->find('first', array( - 'fields' => $this->_collectForeignKeys(), - 'conditions' => array($this->alias . '.' . $this->primaryKey => $id), - 'recursive' => -1, - 'callbacks' => false - )); + if ($updateCounterCache) { + $keys = $this->find('first', array( + 'fields' => $this->_collectForeignKeys(), + 'conditions' => array($this->alias . '.' . $this->primaryKey => $id), + 'recursive' => -1, + 'callbacks' => false + )); + } } if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) { diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index d86295b77..dcd9aefe1 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -147,8 +147,8 @@ class MysqlTest extends CakeTestCase { public function testLocalizedFloats() { $this->skipIf(DS === '\\', 'The locale is not supported in Windows and affect the others tests.'); - $restore = setlocale(LC_ALL, 0); - setlocale(LC_ALL, 'de_DE'); + $restore = setlocale(LC_NUMERIC, 0); + setlocale(LC_NUMERIC, 'de_DE'); $result = $this->Dbo->value(3.141593); $this->assertEquals('3.141593', $result); @@ -171,7 +171,7 @@ class MysqlTest extends CakeTestCase { $result = $this->db->value(2.2E-54); $this->assertEquals('2.2E-54', (string)$result); - setlocale(LC_ALL, $restore); + setlocale(LC_NUMERIC, $restore); } /** diff --git a/lib/Cake/Test/Case/Utility/CakeNumberTest.php b/lib/Cake/Test/Case/Utility/CakeNumberTest.php index 7c2dab19e..2d9f8aafd 100644 --- a/lib/Cake/Test/Case/Utility/CakeNumberTest.php +++ b/lib/Cake/Test/Case/Utility/CakeNumberTest.php @@ -484,6 +484,22 @@ class CakeNumberTest extends CakeTestCase { $this->assertEquals($expected, $result); } +/** + * test toReadableSize() with locales + * + * @return void + */ + public function testReadableSizeLocalized() { + $restore = setlocale(LC_ALL, 0); + setlocale(LC_ALL, 'de_DE'); + $result = $this->Number->toReadableSize(1321205); + $this->assertRegExp('/1[,.]26 MB/', $result); + + $result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512); + $this->assertRegExp('/512[,.]00 GB/', $result); + setlocale(LC_ALL, $restore); + } + /** * testToPercentage method * diff --git a/lib/Cake/Utility/CakeNumber.php b/lib/Cake/Utility/CakeNumber.php index 99f271495..3b21cbc36 100644 --- a/lib/Cake/Utility/CakeNumber.php +++ b/lib/Cake/Utility/CakeNumber.php @@ -70,13 +70,13 @@ class CakeNumber { /** * Formats a number with a level of precision. * - * @param float $number A floating point number. + * @param float $number A floating point number. * @param integer $precision The precision of the returned number. * @return float Formatted float. * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::precision */ public static function precision($number, $precision = 3) { - return sprintf("%01.{$precision}f", $number); + return sprintf("%01.{$precision}F", $number); } /**