Code Modernisation: Replace call_user_func_array() in combination with an empty array in wp-includes/class-wp-hook.php with call_user_func().

Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46139 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-15 11:44:09 +00:00
parent fd05ea0de9
commit d4d853ee3f

View File

@ -259,6 +259,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
*
* @param mixed $value The value to filter.
* @param array $args Additional parameters to pass to the callback functions.
* This array is expected to include $value at index 0.
* @return mixed The filtered value after all hooked functions are applied to it.
*/
public function apply_filters( $value, $args ) {
@ -282,7 +283,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
// Avoid the array_slice if possible.
if ( $the_['accepted_args'] == 0 ) {
$value = call_user_func_array( $the_['function'], array() );
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args );
} else {