WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 2 years ago

#34217 closed defect (bug) (fixed)

Explicitly globalize $blog_id, $public, and $site_id in ms-settings.php

Reported by: danielbachhuber Owned by: jeremyfelt
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.0
Component: Bootstrap/Load Keywords: has-patch
Focuses: multisite Cc:

Attachments (1)

34217.diff (1.4 KB) - added by jeremyfelt 4 years ago.

Download all attachments as: .zip

Change History (7)

#1 @danielbachhuber
4 years ago

  • Description modified (diff)
  • Summary changed from Explicitly globalize $blog_id, $public, and $site_id to Explicitly globalize $blog_id, $public, and $site_id in ms-settings.php

This ticket was mentioned in Slack in #core by danielbachhuber. View the logs.


4 years ago

@jeremyfelt
4 years ago

#3 @jeremyfelt
4 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 4.4
  • Version set to 3.0

$blog_id as an almost explicit global was introduced in [3011] and moved to its current less explicit location in [12732]. I think we'll need to mark it right before calling wp_initial_constants() in wp-settings.php.

I don't remember ever reading this inline comment:

 * The $blog_id global, which you can change in the config allows you to create a simple
 * multiple blog installation using just one WordPress and changing $blog_id around.

34217.diff addresses the $blog_id issue.

$public was merged over with MU. I'm not sure if it was ever used by core, but it is no longer. I think we can get away with not explicitly globalizing it and we should instead think about the consequences of removing it. :)

$site_id was also merged over with MU. It is no longer used anywhere by core either. We should think about the consequences of removing this as well.

Related: we accidentally (maybe?) got rid of the $sites global in 3.9 and there were no explosions, just a desire to have a replacement via wp_get_networks() in #29415.

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


4 years ago

#5 @jeremyfelt
4 years ago

  • Owner set to jeremyfelt
  • Resolution set to fixed
  • Status changed from new to closed

In 34961:

Make $blog_id explicitly global.

$blog_id is used in both single and multisite configurations as a global variable, though has never been explicitly marked as such in the global scope. This can cause confusion depending on how core is loaded.

Fixes #34217.

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.