[wp-trac] [WordPress Trac] #62035: SITE_ID_CURRENT_SITE broken in 6.3 or later (was: BLOG_ID_CURRENT_SITE broken in 6.3 or later)

WordPress Trac noreply at wordpress.org
Thu Sep 12 08:07:37 UTC 2024


#62035: SITE_ID_CURRENT_SITE broken in 6.3 or later
--------------------------------+------------------------------
 Reporter:  scottculverhouse    |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Networks and Sites  |     Version:  6.3
 Severity:  normal              |  Resolution:
 Keywords:  reporter-feedback   |     Focuses:  multisite
--------------------------------+------------------------------

Comment (by scottculverhouse):

 Replying to [comment:1 ironprogrammer]:
 > Could you provide additional information on the error or what isn't
 working as expected since the strict comparison update?
 [https://github.com/WordPress/wordpress-
 develop/blob/a8d12183f23694718756c9e84338e12342b2fcb9/src/wp-includes
 /class-wp-network.php#L31-L33 Since version 4.6], the network ID has been
 an `int`, and enforced as such by the [https://github.com/WordPress
 /wordpress-develop/blob/a8d12183f23694718756c9e84338e12342b2fcb9/src/wp-
 includes/class-wp-network.php#L153-L154
 getter]/[https://github.com/WordPress/wordpress-
 develop/blob/a8d12183f23694718756c9e84338e12342b2fcb9/src/wp-includes
 /class-wp-network.php#L197-L199 setter]. In the updated code, `$this->id`
 shouldn't be a string ([https://github.com/WordPress/wordpress-
 develop/blob/a8d12183f23694718756c9e84338e12342b2fcb9/src/wp-includes
 /class-wp-network.php#L65 compared with] `$this->blog_id` which is still a
 string for backward compat).

 Thanks for your prompt response, I think something funky is going on but
 can't put my finger on it. I've added some `var_dump` inside `__get` /
 `__isset` & `__set` to see what's going on. Also added a
 `var_dump($this->id)` which is returning `string(1) "1"`. Please see
 attached diff.

 The output of this debugging is as follows


 {{{

 string(5) "__get"
 string(2) "id"
 string(7) "__isset"
 string(7) "blog_id"
 string(5) "__get"
 string(7) "blog_id"
 string(30) "top of get_main_site_id method"
 string(1) "1"
 stopped
 }}}

 So to me it appears the `var_dump($this->id);` is not going through
 `__get` magic method. Like I said something "funky is going on", I'm not
 familiar with the WP source code so hope this helps.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62035#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list