In WP_Query, only call magic method internals again whitelists of properties and methods, $compat_fields and $compat_methods. Remove __unset() since __set() is not implemented.

See #30891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-11 22:41:24 +00:00
parent 61e12e00c1
commit eed3698c49
2 changed files with 17 additions and 18 deletions

View File

@ -1300,6 +1300,10 @@ class WP_Query {
*/
private $stopwords;
private $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );
private $compat_methods = array( 'init_query_flags', 'parse_tax_query' );
/**
* Resets query flags to false.
*
@ -3956,11 +3960,13 @@ class WP_Query {
* @return mixed Property.
*/
public function __get( $name ) {
return $this->$name;
if ( in_array( $name, $this->compat_fields ) ) {
return $this->$name;
}
}
/**
* Make private properties settable for backwards compatibility.
* Make private properties checkable for backwards compatibility.
*
* @since 4.0.0
* @access public
@ -3969,19 +3975,9 @@ class WP_Query {
* @return bool Whether the property is set.
*/
public function __isset( $name ) {
return isset( $this->$name );
}
/**
* Make private properties settable for backwards compatibility.
*
* @since 4.0.0
* @access public
*
* @param string $name Property to unset.
*/
public function __unset( $name ) {
unset( $this->$name );
if ( in_array( $name, $this->compat_fields ) ) {
return isset( $this->$name );
}
}
/**
@ -3992,10 +3988,13 @@ class WP_Query {
*
* @param callable $name Method to call.
* @param array $arguments Arguments to pass when calling.
* @return mixed|bool Return value of the callback, otherwise false.
* @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 ( in_array( $name, $this->compat_methods ) ) {
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-31150';
$wp_version = '4.2-alpha-31151';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.