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
This commit is contained in:
parent
2a35b3e7df
commit
e6bbff13c5
|
@ -239,7 +239,7 @@ class WP_List_Table {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( in_array( $name, $this->compat_methods ) ) {
|
if ( in_array( $name, $this->compat_methods ) ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->$name( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ class WP_Comment_Query {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( 'get_search_sql' === $name ) {
|
if ( 'get_search_sql' === $name ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->get_search_sql( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ class WP_oEmbed {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( in_array( $name, $this->compat_methods ) ) {
|
if ( in_array( $name, $this->compat_methods ) ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->$name( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3561,7 +3561,7 @@ class WP_Query {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( in_array( $name, $this->compat_methods ) ) {
|
if ( in_array( $name, $this->compat_methods ) ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->$name( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ class WP_Roles {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( '_init' === $name ) {
|
if ( '_init' === $name ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->_init( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -885,7 +885,7 @@ class WP_User_Query {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( 'get_search_sql' === $name ) {
|
if ( 'get_search_sql' === $name ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->get_search_sql( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,7 +444,7 @@ class WP_User {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( '_init_caps' === $name ) {
|
if ( '_init_caps' === $name ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->_init_caps( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( '_multisite_getUsersBlogs' === $name ) {
|
if ( '_multisite_getUsersBlogs' === $name ) {
|
||||||
return call_user_func_array( array( $this, $name ), $arguments );
|
return $this->_multisite_getUsersBlogs( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue