From c7bed35251b1e30fb1c99a5432ca5b1c17437bc7 Mon Sep 17 00:00:00 2001 From: RockonShajib3 <81747062+RockonShajib3@users.noreply.github.com> Date: Sun, 27 Nov 2022 12:05:07 +0600 Subject: [PATCH 1/2] Use Strict Comparison except Loose Comparison --- src/wp-includes/class-wp-hook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php index 4796503dcc2a9..20496f410b79a 100644 --- a/src/wp-includes/class-wp-hook.php +++ b/src/wp-includes/class-wp-hook.php @@ -302,7 +302,7 @@ public function apply_filters( $value, $args ) { } // Avoid the array_slice() if possible. - if ( 0 == $the_['accepted_args'] ) { + if ( 0 === $the_['accepted_args'] ) { $value = call_user_func( $the_['function'] ); } elseif ( $the_['accepted_args'] >= $num_args ) { $value = call_user_func_array( $the_['function'], $args ); From 0412d30a33b0e630d2dc4a1657c539147991c8ac Mon Sep 17 00:00:00 2001 From: costdev Date: Fri, 20 Jan 2023 19:13:29 +0000 Subject: [PATCH 2/2] Cast `$the_['accepted_args']` to `int` for BC. --- src/wp-includes/class-wp-hook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-hook.php b/src/wp-includes/class-wp-hook.php index 20496f410b79a..5b99209fb33cf 100644 --- a/src/wp-includes/class-wp-hook.php +++ b/src/wp-includes/class-wp-hook.php @@ -302,7 +302,7 @@ public function apply_filters( $value, $args ) { } // Avoid the array_slice() if possible. - if ( 0 === $the_['accepted_args'] ) { + if ( 0 === (int) $the_['accepted_args'] ) { $value = call_user_func( $the_['function'] ); } elseif ( $the_['accepted_args'] >= $num_args ) { $value = call_user_func_array( $the_['function'], $args );