Skip to content

Commit 77c6420

Browse files
committed
Some classes with __get() method also need __set().
See #27881, #22234. git-svn-id: https://develop.svn.wordpress.org/trunk@28521 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e76545e commit 77c6420

9 files changed

Lines changed: 110 additions & 1 deletion

src/wp-admin/custom-background.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ public function __get( $name ) {
6969
return $this->$name;
7070
}
7171

72+
/**
73+
* Make private properties setable for backwards compatibility
74+
*
75+
* @since 4.0.0
76+
* @param string $name
77+
* @param string $value
78+
* @return mixed
79+
*/
80+
public function __set( $name, $value ) {
81+
return $this->$name = $value;
82+
}
83+
84+
7285
/**
7386
* Set up the hooks for the Custom Background admin page.
7487
*

src/wp-admin/custom-header.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ public function __get( $name ) {
9191
return $this->$name;
9292
}
9393

94+
/**
95+
* Make private properties setable for backwards compatibility
96+
*
97+
* @since 4.0.0
98+
* @param string $name
99+
* @param string $value
100+
* @return mixed
101+
*/
102+
public function __set( $name, $value ) {
103+
return $this->$name = $value;
104+
}
105+
94106
/**
95107
* Set up the hooks for the Custom Header admin page.
96108
*

src/wp-admin/includes/class-wp-filesystem-base.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ public function __get( $name ) {
5555
return $this->$name;
5656
}
5757

58+
/**
59+
* Make private properties setable for backwards compatibility
60+
*
61+
* @since 4.0.0
62+
* @param string $name
63+
* @param string $value
64+
* @return mixed
65+
*/
66+
public function __set( $name, $value ) {
67+
return $this->$name = $value;
68+
}
69+
5870
/**
5971
* Return the path on the remote filesystem of ABSPATH.
6072
*

src/wp-admin/includes/class-wp-list-table.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ public function __get( $name ) {
106106
return $this->$name;
107107
}
108108

109+
/**
110+
* Make private properties setable for backwards compatibility
111+
*
112+
* @since 4.0.0
113+
* @param string $name
114+
* @param string $value
115+
* @return mixed
116+
*/
117+
public function __set( $name, $value ) {
118+
return $this->$name = $value;
119+
}
120+
109121
/**
110122
* Make private/protected methods readable for backwards compatibility
111123
*

src/wp-includes/cache.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class WP_Object_Cache {
268268
* @access private
269269
* @since 2.0.0
270270
*/
271-
public $cache = array();
271+
private $cache = array();
272272

273273
/**
274274
* The amount of times the cache data was already stored in the cache.
@@ -317,6 +317,18 @@ public function __get( $name ) {
317317
return $this->$name;
318318
}
319319

320+
/**
321+
* Make private properties setable for backwards compatibility
322+
*
323+
* @since 4.0.0
324+
* @param string $name
325+
* @param string $value
326+
* @return mixed
327+
*/
328+
public function __set( $name, $value ) {
329+
return $this->$name = $value;
330+
}
331+
320332
/**
321333
* Adds data to the cache if it doesn't already exist.
322334
*

src/wp-includes/class-wp-ajax-response.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ public function __get( $name ) {
4040
return $this->$name;
4141
}
4242

43+
/**
44+
* Make private properties setable for backwards compatibility
45+
*
46+
* @since 4.0.0
47+
* @param string $name
48+
* @param string $value
49+
* @return mixed
50+
*/
51+
public function __set( $name, $value ) {
52+
return $this->$name = $value;
53+
}
54+
4355
/**
4456
* Append to XML response based on given arguments.
4557
*

src/wp-includes/class-wp-error.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ public function __get( $name ) {
7575
return $this->$name;
7676
}
7777

78+
/**
79+
* Make private properties setable for backwards compatibility
80+
*
81+
* @since 4.0.0
82+
* @param string $name
83+
* @param string $value
84+
* @return mixed
85+
*/
86+
public function __set( $name, $value ) {
87+
return $this->$name = $value;
88+
}
89+
7890
/**
7991
* Retrieve all error codes.
8092
*

src/wp-includes/class-wp-walker.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ public function __get( $name ) {
5050
return $this->$name;
5151
}
5252

53+
/**
54+
* Make private properties setable for backwards compatibility
55+
*
56+
* @since 4.0.0
57+
* @param string $name
58+
* @param string $value
59+
* @return mixed
60+
*/
61+
public function __set( $name, $value ) {
62+
return $this->$name = $value;
63+
}
64+
5365
/**
5466
* Starts the list before the elements are added.
5567
*

src/wp-includes/class-wp.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,18 @@ public function __get( $name ) {
673673
return $this->$name;
674674
}
675675

676+
/**
677+
* Make private properties setable for backwards compatibility
678+
*
679+
* @since 4.0.0
680+
* @param string $name
681+
* @param string $value
682+
* @return mixed
683+
*/
684+
public function __set( $name, $value ) {
685+
return $this->$name = $value;
686+
}
687+
676688
/**
677689
* Make private/protected methods readable for backwards compatibility
678690
*

0 commit comments

Comments
 (0)