From d6d707ee02d07b9f085523c6020fef503ccd9cb9 Mon Sep 17 00:00:00 2001 From: Piotr Delawski Date: Mon, 22 Jul 2024 12:42:28 +0200 Subject: [PATCH 1/2] Replace `strlen` with custom callback that accepts `null` This is done due to `strlen` not accepting `null` in PHP 8+. --- classes/class-log.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/class-log.php b/classes/class-log.php index f9e66fe07..81f4c575d 100644 --- a/classes/class-log.php +++ b/classes/class-log.php @@ -194,7 +194,12 @@ public function is_record_excluded( $connector, $context, $action, $user = null, 'role' => ( ! empty( $exclude_rule['author_or_role'] ) && ! is_numeric( $exclude_rule['author_or_role'] ) ) ? $exclude_rule['author_or_role'] : null, ); - $exclude_rules = array_filter( $exclude, 'strlen' ); + $exclude_rules = array_filter( + $exclude, + function ( $value ) { + return ! is_null( $value ) && '' !== $value; + } + ); if ( $this->record_matches_rules( $record, $exclude_rules ) ) { $exclude_record = true; From 9d47e2549958cf0c386b67a660ca08c5eebf65ea Mon Sep 17 00:00:00 2001 From: Piotr Delawski Date: Mon, 22 Jul 2024 16:46:19 +0200 Subject: [PATCH 2/2] Remove redundant check --- classes/class-log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-log.php b/classes/class-log.php index 81f4c575d..b119affe6 100644 --- a/classes/class-log.php +++ b/classes/class-log.php @@ -197,7 +197,7 @@ public function is_record_excluded( $connector, $context, $action, $user = null, $exclude_rules = array_filter( $exclude, function ( $value ) { - return ! is_null( $value ) && '' !== $value; + return ! is_null( $value ); } );