Skip to content

Commit

Permalink
Replace strlen with custom callback that accepts null
Browse files Browse the repository at this point in the history
This is done due to `strlen` not accepting `null` in PHP 8+.
  • Loading branch information
delawski committed Jul 22, 2024
1 parent 159e61f commit d6d707e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion classes/class-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d6d707e

Please sign in to comment.