From 7a2da945eb352317b7f3597f42fad153a9a183b9 Mon Sep 17 00:00:00 2001 From: Bill Van Pelt Date: Fri, 5 Feb 2021 10:23:28 -0500 Subject: [PATCH 1/4] The mcrypt_decrypt has been removed since PHP 7.2. This is throwing PHPCS errors. Added checks for PHP version and CS ignore. --- src/inc/api/class-mcrypt.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/inc/api/class-mcrypt.php b/src/inc/api/class-mcrypt.php index 3e0cc6b..8640e9a 100644 --- a/src/inc/api/class-mcrypt.php +++ b/src/inc/api/class-mcrypt.php @@ -84,6 +84,12 @@ public static function upgrade_mcrypt_option( $encrypted_string ) { * @return string */ public static function mcrypt_decrypt( $encrypted_string ) { + if ( version_compare( phpversion(), '7.2', '<' ) ) { + return new \WP_Error( 'php_version', __( 'PHP version is to low to support mcrypt_decrypt. This function has been DEPRECATED as of PHP 7.1.0 and REMOVED as of PHP 7.2.0. Relying on this function is highly discouraged.', 'wpop' ) ); + } + + // Throws errors depending on version of PHP. Added the catch above to account for this. + // @codingStandardsIgnoreStart return trim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, @@ -92,6 +98,7 @@ public static function mcrypt_decrypt( $encrypted_string ) { MCRYPT_MODE_ECB ) ); + // @codingStandardsIgnoreEnd } } From ee01ad434537831e1b2ba5798df88acdca298125 Mon Sep 17 00:00:00 2001 From: Bill Van Pelt Date: Fri, 5 Feb 2021 10:42:58 -0500 Subject: [PATCH 2/4] Fixing compare. --- src/inc/api/class-mcrypt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inc/api/class-mcrypt.php b/src/inc/api/class-mcrypt.php index 8640e9a..56a199f 100644 --- a/src/inc/api/class-mcrypt.php +++ b/src/inc/api/class-mcrypt.php @@ -84,7 +84,7 @@ public static function upgrade_mcrypt_option( $encrypted_string ) { * @return string */ public static function mcrypt_decrypt( $encrypted_string ) { - if ( version_compare( phpversion(), '7.2', '<' ) ) { + if ( version_compare( phpversion(), '7.1', '>' ) ) { return new \WP_Error( 'php_version', __( 'PHP version is to low to support mcrypt_decrypt. This function has been DEPRECATED as of PHP 7.1.0 and REMOVED as of PHP 7.2.0. Relying on this function is highly discouraged.', 'wpop' ) ); } From c780072bd94503aa6a1426b1df965df1c6b3ef07 Mon Sep 17 00:00:00 2001 From: Bill Van Pelt Date: Fri, 5 Feb 2021 10:54:43 -0500 Subject: [PATCH 3/4] Making sure if the PHP version is above 7.2 it will throw the error. PHP Version 7.1.3.4 is not >= to 7.2. No error PHP Version 7.2.3 is >= 7.2. Error --- src/inc/api/class-mcrypt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inc/api/class-mcrypt.php b/src/inc/api/class-mcrypt.php index 56a199f..b239e2d 100644 --- a/src/inc/api/class-mcrypt.php +++ b/src/inc/api/class-mcrypt.php @@ -84,7 +84,7 @@ public static function upgrade_mcrypt_option( $encrypted_string ) { * @return string */ public static function mcrypt_decrypt( $encrypted_string ) { - if ( version_compare( phpversion(), '7.1', '>' ) ) { + if ( version_compare( phpversion(), '7.2', '>=' ) ) { return new \WP_Error( 'php_version', __( 'PHP version is to low to support mcrypt_decrypt. This function has been DEPRECATED as of PHP 7.1.0 and REMOVED as of PHP 7.2.0. Relying on this function is highly discouraged.', 'wpop' ) ); } From 342fbd263f522f4d1459708b22c24e06db8ada52 Mon Sep 17 00:00:00 2001 From: Bill Van Pelt Date: Fri, 5 Feb 2021 11:07:50 -0500 Subject: [PATCH 4/4] Versino bump --- src/class-wordpress-options-panels.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/class-wordpress-options-panels.php b/src/class-wordpress-options-panels.php index 0ebd59e..169574c 100644 --- a/src/class-wordpress-options-panels.php +++ b/src/class-wordpress-options-panels.php @@ -4,7 +4,7 @@ * * @authors 🌵 WordPress Phoenix 🌵 / Seth Carstens, David Ryan * @package wpop - * @version 5.0.3 + * @version 5.0.4 * @license GPL-2.0+ - please retain comments that express original build of this file by the author. */