From e6bbff13c550a059b6103745ad959fefa4ccbb18 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 15 Sep 2019 11:53:56 +0000 Subject: [PATCH] Code Modernisation: Replace `call_user_func_array()` in various `__call()` methods with dynamic function calls. The callback in these functions is always checked against a limited list of valid callbacks that can be safely changed to dynamic function calls. Props jrf. See #47678. Built from https://develop.svn.wordpress.org/trunk@46144 git-svn-id: http://core.svn.wordpress.org/trunk@45956 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-list-table.php | 2 +- wp-includes/class-wp-comment-query.php | 2 +- wp-includes/class-wp-oembed.php | 2 +- wp-includes/class-wp-query.php | 2 +- wp-includes/class-wp-roles.php | 2 +- wp-includes/class-wp-user-query.php | 2 +- wp-includes/class-wp-user.php | 2 +- wp-includes/class-wp-xmlrpc-server.php | 2 +- wp-includes/version.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index b02b97cbc8..e5d12ceae9 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -239,7 +239,7 @@ class WP_List_Table { */ public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods ) ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->$name( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index 988d106c9e..9038b6194b 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -124,7 +124,7 @@ class WP_Comment_Query { */ public function __call( $name, $arguments ) { if ( 'get_search_sql' === $name ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->get_search_sql( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-oembed.php b/wp-includes/class-wp-oembed.php index d64bb079bd..b08a5c942e 100644 --- a/wp-includes/class-wp-oembed.php +++ b/wp-includes/class-wp-oembed.php @@ -235,7 +235,7 @@ class WP_oEmbed { */ public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods ) ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->$name( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index 57fd58a4f6..295b93c837 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -3561,7 +3561,7 @@ class WP_Query { */ public function __call( $name, $arguments ) { if ( in_array( $name, $this->compat_methods ) ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->$name( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-roles.php b/wp-includes/class-wp-roles.php index 18b0d55035..6e3004c37c 100644 --- a/wp-includes/class-wp-roles.php +++ b/wp-includes/class-wp-roles.php @@ -101,7 +101,7 @@ class WP_Roles { */ public function __call( $name, $arguments ) { if ( '_init' === $name ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->_init( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-user-query.php b/wp-includes/class-wp-user-query.php index d0abd8f44c..64776e10e8 100644 --- a/wp-includes/class-wp-user-query.php +++ b/wp-includes/class-wp-user-query.php @@ -885,7 +885,7 @@ class WP_User_Query { */ public function __call( $name, $arguments ) { if ( 'get_search_sql' === $name ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->get_search_sql( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-user.php b/wp-includes/class-wp-user.php index 73f7cdf0d5..a1c2b6e2c4 100644 --- a/wp-includes/class-wp-user.php +++ b/wp-includes/class-wp-user.php @@ -444,7 +444,7 @@ class WP_User { */ public function __call( $name, $arguments ) { if ( '_init_caps' === $name ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->_init_caps( ...$arguments ); } return false; } diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index f99a6aaa10..5142efad8c 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -177,7 +177,7 @@ class wp_xmlrpc_server extends IXR_Server { */ public function __call( $name, $arguments ) { if ( '_multisite_getUsersBlogs' === $name ) { - return call_user_func_array( array( $this, $name ), $arguments ); + return $this->_multisite_getUsersBlogs( ...$arguments ); } return false; } diff --git a/wp-includes/version.php b/wp-includes/version.php index da5280f7a5..79de4b0659 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-46143'; +$wp_version = '5.3-alpha-46144'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.