From 39ec01bceb9f6eb81aca0de849dbde95d716a6e9 Mon Sep 17 00:00:00 2001 From: "Jorge A. Torres" Date: Wed, 10 Jan 2024 13:32:35 +0000 Subject: [PATCH] Fix PHP warning related to logging severity threshold (#43448) * Fix PHP warning related to logging default severity threshold * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions --- .../changelog/43448-fix-logging-php-deprecated-warning | 4 ++++ plugins/woocommerce/includes/class-wc-log-levels.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/43448-fix-logging-php-deprecated-warning diff --git a/plugins/woocommerce/changelog/43448-fix-logging-php-deprecated-warning b/plugins/woocommerce/changelog/43448-fix-logging-php-deprecated-warning new file mode 100644 index 00000000000..638e3788fff --- /dev/null +++ b/plugins/woocommerce/changelog/43448-fix-logging-php-deprecated-warning @@ -0,0 +1,4 @@ +Significance: patch +Type: fix +Comment: Fixes a PHP deprecation warning introduced in PR-42979. + diff --git a/plugins/woocommerce/includes/class-wc-log-levels.php b/plugins/woocommerce/includes/class-wc-log-levels.php index 80ca513ebfc..19737d9e066 100644 --- a/plugins/woocommerce/includes/class-wc-log-levels.php +++ b/plugins/woocommerce/includes/class-wc-log-levels.php @@ -78,7 +78,7 @@ abstract class WC_Log_Levels { * @return bool True if $level is a valid level. */ public static function is_valid_level( $level ) { - return array_key_exists( strtolower( $level ), self::$level_to_severity ); + return is_string( $level ) && array_key_exists( strtolower( $level ), self::$level_to_severity ); } /**