Skip to content
This repository
Browse code

Merge branch '2.1' into 2.2

  • Loading branch information...
commit 03e2263b69e4608640a84c954fad0a8c696986ca 2 parents 8161195 + 8b94d9e
ceeram authored June 19, 2012
9  lib/Cake/Controller/CakeErrorController.php
@@ -54,12 +54,15 @@ public function __construct($request = null, $response = null) {
54 54
 			$this->components[] = 'RequestHandler';
55 55
 		}
56 56
 		$this->constructClasses();
  57
+		if ($this->Components->enabled('Auth')) {
  58
+			$this->Components->disable('Auth');
  59
+		}
  60
+		if ($this->Components->enabled('Security')) {
  61
+			$this->Components->disable('Security');
  62
+		}
57 63
 		$this->startupProcess();
58 64
 
59 65
 		$this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
60  
-		if (isset($this->RequestHandler)) {
61  
-			$this->RequestHandler->startup($this);
62  
-		}
63 66
 	}
64 67
 
65 68
 /**
4  lib/Cake/Controller/Component/AuthComponent.php
@@ -264,10 +264,6 @@ public function initialize(Controller $controller) {
264 264
  * @return boolean
265 265
  */
266 266
 	public function startup(Controller $controller) {
267  
-		if ($controller->name == 'CakeError') {
268  
-			return true;
269  
-		}
270  
-
271 267
 		$methods = array_flip(array_map('strtolower', $controller->methods));
272 268
 		$action = strtolower($controller->request->params['action']);
273 269
 
4  lib/Cake/Controller/Component/SecurityComponent.php
@@ -206,10 +206,6 @@ class SecurityComponent extends Component {
206 206
  * @return void
207 207
  */
208 208
 	public function startup(Controller $controller) {
209  
-		if ($controller->name == 'CakeError') {
210  
-			return true;
211  
-		}
212  
-
213 209
 		$this->request = $controller->request;
214 210
 		$this->_action = $this->request->params['action'];
215 211
 		$this->_methodsRequired($controller);
15  lib/Cake/Model/Model.php
@@ -2370,13 +2370,14 @@ public function delete($id = null, $cascade = true) {
2370 2370
 						break;
2371 2371
 					}
2372 2372
 				}
2373  
-
2374  
-				$keys = $this->find('first', array(
2375  
-					'fields' => $this->_collectForeignKeys(),
2376  
-					'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
2377  
-					'recursive' => -1,
2378  
-					'callbacks' => false
2379  
-				));
  2373
+				if ($updateCounterCache) {
  2374
+					$keys = $this->find('first', array(
  2375
+						'fields' => $this->_collectForeignKeys(),
  2376
+						'conditions' => array($this->alias . '.' . $this->primaryKey => $id),
  2377
+						'recursive' => -1,
  2378
+						'callbacks' => false
  2379
+					));
  2380
+				}
2380 2381
 			}
2381 2382
 
2382 2383
 			if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) {
6  lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -147,8 +147,8 @@ public function testQuoting() {
147 147
 	public function testLocalizedFloats() {
148 148
 		$this->skipIf(DS === '\\', 'The locale is not supported in Windows and affect the others tests.');
149 149
 
150  
-		$restore = setlocale(LC_ALL, 0);
151  
-		setlocale(LC_ALL, 'de_DE');
  150
+		$restore = setlocale(LC_NUMERIC, 0);
  151
+		setlocale(LC_NUMERIC, 'de_DE');
152 152
 
153 153
 		$result = $this->Dbo->value(3.141593);
154 154
 		$this->assertEquals('3.141593', $result);
@@ -171,7 +171,7 @@ public function testLocalizedFloats() {
171 171
 		$result = $this->db->value(2.2E-54);
172 172
 		$this->assertEquals('2.2E-54', (string)$result);
173 173
 
174  
-		setlocale(LC_ALL, $restore);
  174
+		setlocale(LC_NUMERIC, $restore);
175 175
 	}
176 176
 
177 177
 /**
16  lib/Cake/Test/Case/Utility/CakeNumberTest.php
@@ -485,6 +485,22 @@ public function testToReadableSize() {
485 485
 	}
486 486
 
487 487
 /**
  488
+ * test toReadableSize() with locales
  489
+ *
  490
+ * @return void
  491
+ */
  492
+	public function testReadableSizeLocalized() {
  493
+		$restore = setlocale(LC_ALL, 0);
  494
+		setlocale(LC_ALL, 'de_DE');
  495
+		$result = $this->Number->toReadableSize(1321205);
  496
+		$this->assertRegExp('/1[,.]26 MB/', $result);
  497
+
  498
+		$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
  499
+		$this->assertRegExp('/512[,.]00 GB/', $result);
  500
+		setlocale(LC_ALL, $restore);
  501
+	}
  502
+
  503
+/**
488 504
  * testToPercentage method
489 505
  *
490 506
  * @return void
4  lib/Cake/Utility/CakeNumber.php
@@ -70,13 +70,13 @@ class CakeNumber {
70 70
 /**
71 71
  * Formats a number with a level of precision.
72 72
  *
73  
- * @param float $number	A floating point number.
  73
+ * @param float $number A floating point number.
74 74
  * @param integer $precision The precision of the returned number.
75 75
  * @return float Formatted float.
76 76
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::precision
77 77
  */
78 78
 	public static function precision($number, $precision = 3) {
79  
-		return sprintf("%01.{$precision}f", $number);
  79
+		return sprintf("%01.{$precision}F", $number);
80 80
 	}
81 81
 
82 82
 /**

0 notes on commit 03e2263

Please sign in to comment.
Something went wrong with that request. Please try again.