From cc3ad790589535a731d8cedb1d8b4aff808c20cd Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 29 May 2020 08:34:40 -0500 Subject: [PATCH] Crypt/Base: create_function isn't needed for PHP >= 5.3.0 --- phpseclib/Crypt/Base.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/phpseclib/Crypt/Base.php b/phpseclib/Crypt/Base.php index 03b176e7..224eaa52 100644 --- a/phpseclib/Crypt/Base.php +++ b/phpseclib/Crypt/Base.php @@ -413,7 +413,7 @@ abstract class Base * @var mixed * @access private */ - var $use_inline_crypt; + var $use_inline_crypt = true; /** * If OpenSSL can be used in ECB but not in CTR we can emulate CTR @@ -495,11 +495,6 @@ abstract class Base } $this->_setEngine(); - - // Determining whether inline crypting can be used by the cipher - if ($this->use_inline_crypt !== false) { - $this->use_inline_crypt = version_compare(PHP_VERSION, '5.3.0') >= 0 || function_exists('create_function'); - } } /** @@ -2602,12 +2597,8 @@ abstract class 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 . ' }'); + eval('$func = function ($_action, &$self, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' } };'); + return $func; } /**