mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.1' into 2.2
This commit is contained in:
commit
03e2263b69
7 changed files with 35 additions and 23 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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']);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue