From 821246b4aee3ec4ef8e3ae61f556d476fdcb5bac Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 19 May 2014 06:31:15 +0000 Subject: [PATCH] Some classes with `__get()` method also need `__set()`. See #27881, #22234. Built from https://develop.svn.wordpress.org/trunk@28521 git-svn-id: http://core.svn.wordpress.org/trunk@28347 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/custom-background.php | 13 +++++++++++++ wp-admin/custom-header.php | 12 ++++++++++++ wp-admin/includes/class-wp-filesystem-base.php | 12 ++++++++++++ wp-admin/includes/class-wp-list-table.php | 12 ++++++++++++ wp-includes/cache.php | 14 +++++++++++++- wp-includes/class-wp-ajax-response.php | 12 ++++++++++++ wp-includes/class-wp-error.php | 12 ++++++++++++ wp-includes/class-wp-walker.php | 12 ++++++++++++ wp-includes/class-wp.php | 12 ++++++++++++ 9 files changed, 110 insertions(+), 1 deletion(-) diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index 46a61ccbb1..8b72ab6ac7 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -69,6 +69,19 @@ class Custom_Background { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + + /** * Set up the hooks for the Custom Background admin page. * diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 81ff4d6a0b..49025a9e40 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -91,6 +91,18 @@ class Custom_Image_Header { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Set up the hooks for the Custom Header admin page. * diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index 86ff7a78db..08eaa0e384 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -55,6 +55,18 @@ class WP_Filesystem_Base { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Return the path on the remote filesystem of ABSPATH. * diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 76552d08fe..d4ccfcc7d5 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -106,6 +106,18 @@ class WP_List_Table { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Make private/protected methods readable for backwards compatibility * diff --git a/wp-includes/cache.php b/wp-includes/cache.php index 734c968140..ce2cc00f7a 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -268,7 +268,7 @@ class WP_Object_Cache { * @access private * @since 2.0.0 */ - public $cache = array(); + private $cache = array(); /** * The amount of times the cache data was already stored in the cache. @@ -317,6 +317,18 @@ class WP_Object_Cache { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Adds data to the cache if it doesn't already exist. * diff --git a/wp-includes/class-wp-ajax-response.php b/wp-includes/class-wp-ajax-response.php index b32f7aa535..4653a7ca0b 100644 --- a/wp-includes/class-wp-ajax-response.php +++ b/wp-includes/class-wp-ajax-response.php @@ -40,6 +40,18 @@ class WP_Ajax_Response { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Append to XML response based on given arguments. * diff --git a/wp-includes/class-wp-error.php b/wp-includes/class-wp-error.php index e93d464cc9..7de5812f56 100644 --- a/wp-includes/class-wp-error.php +++ b/wp-includes/class-wp-error.php @@ -75,6 +75,18 @@ class WP_Error { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Retrieve all error codes. * diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php index 7ee5faf1fa..5cb576506f 100644 --- a/wp-includes/class-wp-walker.php +++ b/wp-includes/class-wp-walker.php @@ -50,6 +50,18 @@ class Walker { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Starts the list before the elements are added. * diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index 2b0590c99a..91dc2348d8 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -673,6 +673,18 @@ class WP_MatchesMapRegex { return $this->$name; } + /** + * Make private properties setable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param string $value + * @return mixed + */ + public function __set( $name, $value ) { + return $this->$name = $value; + } + /** * Make private/protected methods readable for backwards compatibility *