Make WordPress Core

Changeset 31144


Ignore:
Timestamp:
01/11/2015 09:59:54 PM (12 years ago)
Author:
wonderboymusic
Message:

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

See #30891.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r31126 r31144  
    473473         */
    474474        private $total_users = 0;
     475
     476        private $compat_fields = array( 'results', 'total_users' );
    475477
    476478        // SQL clauses
     
    929931         */
    930932        public function __get( $name ) {
    931                 return $this->$name;
     933                if ( in_array( $name, $this->compat_fields ) ) {
     934                        return $this->$name;
     935                }
    932936        }
    933937
     
    938942         * @access public
    939943         *
    940          * @param string $name  Property to set.
     944         * @param string $name  Property to check if set.
    941945         * @param mixed  $value Property value.
    942946         * @return mixed Newly-set property.
    943947         */
    944948        public function __set( $name, $value ) {
    945                 return $this->$name = $value;
     949                if ( in_array( $name, $this->compat_fields ) ) {
     950                        return $this->$name = $value;
     951                }
    946952        }
    947953
     
    956962         */
    957963        public function __isset( $name ) {
    958                 return isset( $this->$name );
     964                if ( in_array( $name, $this->compat_fields ) ) {
     965                        return isset( $this->$name );
     966                }
    959967        }
    960968
     
    968976         */
    969977        public function __unset( $name ) {
    970                 unset( $this->$name );
     978                if ( in_array( $name, $this->compat_fields ) ) {
     979                        unset( $this->$name );
     980                }
    971981        }
    972982
     
    982992         */
    983993        public function __call( $name, $arguments ) {
    984                 return call_user_func_array( array( $this, $name ), $arguments );
     994                if ( 'get_search_sql' === $name ) {
     995                        return call_user_func_array( array( $this, $name ), $arguments );
     996                }
     997                return false;
    985998        }
    986999}
Note: See TracChangeset for help on using the changeset viewer.