Remove outdated checks for old PHP versions

This commit is contained in:
Kijin Sung 2016-03-22 11:34:36 +09:00
parent 1bf110439a
commit a0d9e1c6ad
3 changed files with 7 additions and 21 deletions

View file

@ -1360,10 +1360,9 @@ class Context
* @see Cast variables, such as _srl, page, and cpage, into interger
* @param string $key Variable key
* @param string $val Variable value
* @param string $do_stripslashes Whether to strip slashes
* @return mixed filtered value. Type are string or array
*/
public function _filterRequestVar($key, $val, $do_stripslashes = 1)
public function _filterRequestVar($key, $val)
{
if(!($isArray = is_array($val)))
{
@ -1389,19 +1388,6 @@ class Context
else
{
$result[$k] = $v;
if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
{
if (is_array($result[$k]))
{
array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
}
else
{
$result[$k] = stripslashes($result[$k]);
}
}
if(is_array($result[$k]))
{
array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });

View file

@ -79,11 +79,11 @@ class Password
public static function getSupportedAlgorithms()
{
$retval = array();
if (version_compare(PHP_VERSION, '5.3.7', '>=') && defined('\CRYPT_BLOWFISH'))
if (defined('\CRYPT_BLOWFISH'))
{
$retval['bcrypt'] = 'bcrypt';
}
if (function_exists('hash_hmac') && in_array('sha512', hash_algos()))
if (in_array('sha512', hash_algos()))
{
$retval['pbkdf2'] = 'pbkdf2';
}

View file

@ -58,7 +58,7 @@ class Security
$key = substr(hash('sha256', $key, true), 0, 16);
// Use defuse/php-encryption if possible.
if (!$force_compat && version_compare(\PHP_VERSION, '5.4.0', '>=') && function_exists('openssl_encrypt'))
if (!$force_compat && function_exists('openssl_encrypt'))
{
try
{
@ -96,7 +96,7 @@ class Security
}
// Use defuse/php-encryption if possible.
if (!$force_compat && version_compare(\PHP_VERSION, '5.4.0', '>=') && function_exists('openssl_decrypt'))
if (!$force_compat && function_exists('openssl_decrypt'))
{
try
{
@ -147,11 +147,11 @@ class Security
{
$entropy = random_bytes($entropy_capped_bytes);
}
elseif(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(\PHP_VERSION, '5.4', '>=')))
elseif(function_exists('openssl_random_pseudo_bytes'))
{
$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
}
elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(\PHP_VERSION, '5.3.7', '>=')))
elseif(function_exists('mcrypt_create_iv') && !$is_windows)
{
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_DEV_URANDOM);
}