In WP_User_Query
, only call magic method internals against a whitelist of properties, $compat_fields
.
See #30891. git-svn-id: https://develop.svn.wordpress.org/trunk@31144 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
43b2de66c6
commit
bbc7ca2d0d
@ -473,6 +473,8 @@ class WP_User_Query {
|
||||
*/
|
||||
private $total_users = 0;
|
||||
|
||||
private $compat_fields = array( 'results', 'total_users' );
|
||||
|
||||
// SQL clauses
|
||||
public $query_fields;
|
||||
public $query_from;
|
||||
@ -928,7 +930,9 @@ class WP_User_Query {
|
||||
* @return mixed Property.
|
||||
*/
|
||||
public function __get( $name ) {
|
||||
return $this->$name;
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -937,12 +941,14 @@ class WP_User_Query {
|
||||
* @since 4.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $name Property to set.
|
||||
* @param string $name Property to check if set.
|
||||
* @param mixed $value Property value.
|
||||
* @return mixed Newly-set property.
|
||||
*/
|
||||
public function __set( $name, $value ) {
|
||||
return $this->$name = $value;
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
return $this->$name = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -955,7 +961,9 @@ class WP_User_Query {
|
||||
* @return bool Whether the property is set.
|
||||
*/
|
||||
public function __isset( $name ) {
|
||||
return isset( $this->$name );
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
return isset( $this->$name );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -967,7 +975,9 @@ class WP_User_Query {
|
||||
* @param string $name Property to unset.
|
||||
*/
|
||||
public function __unset( $name ) {
|
||||
unset( $this->$name );
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
unset( $this->$name );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -981,7 +991,10 @@ class WP_User_Query {
|
||||
* @return mixed|bool Return value of the callback, false otherwise.
|
||||
*/
|
||||
public function __call( $name, $arguments ) {
|
||||
return call_user_func_array( array( $this, $name ), $arguments );
|
||||
if ( 'get_search_sql' === $name ) {
|
||||
return call_user_func_array( array( $this, $name ), $arguments );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user