mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-05 13:07:53 +00:00
Crypt/Base: use eval() instead of create_function() for >= 5.3
This commit is contained in:
parent
6f47ef808e
commit
98d46db7c5
@ -526,8 +526,8 @@ class Crypt_Base
|
||||
$this->_setEngine();
|
||||
|
||||
// Determining whether inline crypting can be used by the cipher
|
||||
if ($this->use_inline_crypt !== false && function_exists('create_function')) {
|
||||
$this->use_inline_crypt = true;
|
||||
if ($this->use_inline_crypt !== false) {
|
||||
$this->use_inline_crypt = version_compare(PHP_VERSION, '5.3.0') || function_exists('create_function');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2550,6 +2550,11 @@ class Crypt_Base
|
||||
}
|
||||
|
||||
// Create the $inline function and return its name as string. Ready to run!
|
||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||
eval('$func = function ($_action, &$self, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' } };');
|
||||
return $func;
|
||||
}
|
||||
|
||||
return create_function('$_action, &$self, $_text', $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user