mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Simplify number formatting.
This commit is contained in:
parent
434d3a7137
commit
2359fb7e2e
2 changed files with 5 additions and 13 deletions
|
@ -1,9 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* SecurityTest file
|
|
||||||
*
|
|
||||||
* PHP 5
|
|
||||||
*
|
|
||||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
|
@ -12,7 +8,6 @@
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||||
* @package Cake.Test.Case.Utility
|
|
||||||
* @since CakePHP(tm) v 1.2.0.5432
|
* @since CakePHP(tm) v 1.2.0.5432
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -235,7 +235,7 @@ class Security {
|
||||||
protected static function _crypt($password, $type = null, $salt = false) {
|
protected static function _crypt($password, $type = null, $salt = false) {
|
||||||
$options = array(
|
$options = array(
|
||||||
'saltFormat' => array(
|
'saltFormat' => array(
|
||||||
'blowfish' => '$2a$%s$%s',
|
'blowfish' => '$2a$%02d$%s',
|
||||||
),
|
),
|
||||||
'saltLength' => array(
|
'saltLength' => array(
|
||||||
'blowfish' => 22,
|
'blowfish' => 22,
|
||||||
|
@ -264,14 +264,11 @@ class Security {
|
||||||
), E_USER_WARNING);
|
), E_USER_WARNING);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$vspArgs = array();
|
|
||||||
$salt = self::salt($saltLength[$hashType]);
|
$salt = self::salt($saltLength[$hashType]);
|
||||||
if ($hashType === 'blowfish') {
|
$vspArgs = array(
|
||||||
$bfCost = chr(ord('0') + $cost / 10);
|
$cost,
|
||||||
$bfCost .= chr(ord('0') + $cost % 10);
|
$salt,
|
||||||
$vspArgs[] = $bfCost;
|
);
|
||||||
}
|
|
||||||
$vspArgs[] = $salt;
|
|
||||||
$salt = vsprintf($saltFormat[$hashType], $vspArgs);
|
$salt = vsprintf($saltFormat[$hashType], $vspArgs);
|
||||||
} elseif ($salt === true || strpos($salt, '$2a$') !== 0 || strlen($salt) < 29) {
|
} elseif ($salt === true || strpos($salt, '$2a$') !== 0 || strlen($salt) < 29) {
|
||||||
trigger_error(__d(
|
trigger_error(__d(
|
||||||
|
|
Loading…
Add table
Reference in a new issue