diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index 72395c26b3..538552133d 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -802,30 +802,33 @@ class WP_Site_Health { * Make the check for available PHP modules into a simple boolean operator for a cleaner test runner. * * @since 5.2.0 - * @since 5.3.0 The `$constant` and `$class` parameters were added. + * @since 5.3.0 The `$constant_name` and `$class_name` parameters were added. * - * @param string $extension Optional. The extension name to test. Default null. - * @param string $function Optional. The function name to test. Default null. - * @param string $constant Optional. The constant name to test for. Default null. - * @param string $class Optional. The class name to test for. Default null. + * @param string $extension_name Optional. The extension name to test. Default null. + * @param string $function_name Optional. The function name to test. Default null. + * @param string $constant_name Optional. The constant name to test for. Default null. + * @param string $class_name Optional. The class name to test for. Default null. * @return bool Whether or not the extension and function are available. */ - private function test_php_extension_availability( $extension = null, $function = null, $constant = null, $class = null ) { + private function test_php_extension_availability( $extension_name = null, $function_name = null, $constant_name = null, $class_name = null ) { // If no extension or function is passed, claim to fail testing, as we have nothing to test against. - if ( ! $extension && ! $function && ! $constant && ! $class ) { + if ( ! $extension_name && ! $function_name && ! $constant_name && ! $class_name ) { return false; } - if ( $extension && ! extension_loaded( $extension ) ) { + if ( $extension_name && ! extension_loaded( $extension_name ) ) { return false; } - if ( $function && ! function_exists( $function ) ) { + + if ( $function_name && ! function_exists( $function_name ) ) { return false; } - if ( $constant && ! defined( $constant ) ) { + + if ( $constant_name && ! defined( $constant_name ) ) { return false; } - if ( $class && ! class_exists( $class ) ) { + + if ( $class_name && ! class_exists( $class_name ) ) { return false; } @@ -994,10 +997,10 @@ class WP_Site_Health { $failures = array(); foreach ( $modules as $library => $module ) { - $extension = ( isset( $module['extension'] ) ? $module['extension'] : null ); - $function = ( isset( $module['function'] ) ? $module['function'] : null ); - $constant = ( isset( $module['constant'] ) ? $module['constant'] : null ); - $class_name = ( isset( $module['class'] ) ? $module['class'] : null ); + $extension_name = ( isset( $module['extension'] ) ? $module['extension'] : null ); + $function_name = ( isset( $module['function'] ) ? $module['function'] : null ); + $constant_name = ( isset( $module['constant'] ) ? $module['constant'] : null ); + $class_name = ( isset( $module['class'] ) ? $module['class'] : null ); // If this module is a fallback for another function, check if that other function passed. if ( isset( $module['fallback_for'] ) ) { @@ -1012,7 +1015,10 @@ class WP_Site_Health { } } - if ( ! $this->test_php_extension_availability( $extension, $function, $constant, $class_name ) && ( ! isset( $module['php_bundled_version'] ) || version_compare( PHP_VERSION, $module['php_bundled_version'], '<' ) ) ) { + if ( ! $this->test_php_extension_availability( $extension_name, $function_name, $constant_name, $class_name ) + && ( ! isset( $module['php_bundled_version'] ) + || version_compare( PHP_VERSION, $module['php_bundled_version'], '<' ) ) + ) { if ( $module['required'] ) { $result['status'] = 'critical';