Ticket #36717: 36717.10.diff
File 36717.10.diff, 3.8 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-network.php
18 18 * 19 19 * @since 4.4.0 20 20 * 21 * @property int $id22 21 * @property int $site_id 23 22 */ 24 23 class WP_Network { … … 27 26 * Network ID. 28 27 * 29 28 * @since 4.4.0 30 * @since 4.6.0 Converted from public to private to explicitly enable more intuitive 31 * access via magic methods. As part of the access change, the type was 32 * also changed from `string` to `int`. 33 * @access private 29 * @access public 34 30 * @var int 35 31 */ 36 p rivate$id;32 public $id; 37 33 38 34 /** 39 35 * Domain of the network. … … 65 61 * @access private 66 62 * @var string 67 63 */ 68 p rivate$blog_id = '0';64 public $blog_id = '0'; 69 65 70 66 /** 71 67 * Domain used to set cookies for this network. … … 154 150 */ 155 151 public function __get( $key ) { 156 152 switch ( $key ) { 157 case 'id';158 return (int) $this->id;159 case 'blog_id':160 return $this->blog_id;161 153 case 'site_id': 162 154 return (int) $this->blog_id; 163 155 } … … 178 170 */ 179 171 public function __isset( $key ) { 180 172 switch ( $key ) { 181 case 'id':182 case 'blog_id':183 173 case 'site_id': 184 174 return true; 185 175 } … … 200 190 */ 201 191 public function __set( $key, $value ) { 202 192 switch ( $key ) { 203 case 'id':204 $this->id = (int) $value;205 break;206 case 'blog_id':207 193 case 'site_id': 208 194 $this->blog_id = (string) $value; 209 195 break; -
src/wp-includes/class-wp-site.php
26 26 * A numeric string, for compatibility reasons. 27 27 * 28 28 * @since 4.5.0 29 * @since 4.6.0 Converted from public to private to explicitly enable more intuitive 30 * access via magic methods. 31 * @access private 29 * @access public 32 30 * @var string 33 31 */ 34 p rivate$blog_id;32 public $blog_id; 35 33 36 34 /** 37 35 * Domain of the site. … … 60 58 * A numeric string, for compatibility reasons. 61 59 * 62 60 * @since 4.5.0 63 * @since 4.6.0 Converted from public to private to explicitly enable more intuitive 64 * access via magic methods. 65 * @access private 61 * @access public 66 62 * @var string 67 63 */ 68 p rivate$site_id = '0';64 public $site_id = '0'; 69 65 70 66 /** 71 67 * The date on which the site was created or registered. … … 234 230 switch ( $key ) { 235 231 case 'id': 236 232 return (int) $this->blog_id; 237 case 'blog_id':238 return $this->blog_id;239 case 'site_id':240 return $this->site_id;241 233 case 'network_id': 242 234 return (int) $this->site_id; 243 235 case 'blogname': … … 269 261 public function __isset( $key ) { 270 262 switch ( $key ) { 271 263 case 'id': 272 case 'blog_id':273 case 'site_id':274 264 case 'network_id': 275 265 return true; 276 266 case 'blogname': … … 300 290 public function __set( $key, $value ) { 301 291 switch ( $key ) { 302 292 case 'id': 303 case 'blog_id':304 293 $this->blog_id = (string) $value; 305 294 break; 306 case 'site_id':307 295 case 'network_id': 308 296 $this->site_id = (string) $value; 309 297 break; -
tests/phpunit/tests/multisite/network.php
87 87 return 3; 88 88 } 89 89 90 /** 91 * @ticket 37050 92 */ 93 function test_wp_network_object_id_property_is_int() { 90 function test_wp_network_object_id_property_is_string() { 94 91 $id = self::factory()->network->create(); 95 92 96 93 $network = WP_Network::get_instance( $id ); 97 94 98 $this->assertSame( ( int) $id, $network->id );95 $this->assertSame( (string) $id, $network->id ); 99 96 } 100 97 101 98 /**