In WP_User_Query, only call magic method internals against a whitelist of properties, $compat_fields.

See #30891.

Built from https://develop.svn.wordpress.org/trunk@31144


git-svn-id: http://core.svn.wordpress.org/trunk@31125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-11 22:00:23 +00:00
parent d079899553
commit a79c242038
2 changed files with 20 additions and 7 deletions

View File

@ -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;
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31143';
$wp_version = '4.2-alpha-31144';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.