From 554b1425ed22cc948bdde3a5c6bd77491d2d6d88 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Thu, 8 Oct 2015 21:45:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@34961 git-svn-id: http://core.svn.wordpress.org/trunk@34926 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-constants.php | 9 ++------- wp-includes/version.php | 2 +- wp-settings.php | 9 +++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/wp-includes/default-constants.php b/wp-includes/default-constants.php index 1ec1b36350..795b9190dd 100644 --- a/wp-includes/default-constants.php +++ b/wp-includes/default-constants.php @@ -11,6 +11,8 @@ * @see wp_debug_mode() * * @since 3.0.0 + * + * @global int $blog_id */ function wp_initial_constants() { global $blog_id; @@ -28,13 +30,6 @@ function wp_initial_constants() { define( 'WP_MAX_MEMORY_LIMIT', '256M' ); } - /** - * 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. - * - * @global int $blog_id - * @since 2.0.0 - */ if ( ! isset($blog_id) ) $blog_id = 1; diff --git a/wp-includes/version.php b/wp-includes/version.php index 9c2384d385..78b81c615e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34960'; +$wp_version = '4.4-alpha-34961'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-settings.php b/wp-settings.php index 55b8dae211..e0e39754ea 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -29,6 +29,15 @@ require( ABSPATH . WPINC . '/default-constants.php' ); global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version; require( ABSPATH . WPINC . '/version.php' ); +/** + * If not already configured, `$blog_id` will default to 1 in a single site + * configuration. In multisite, it will be overridden by default in ms-settings.php. + * + * @global int $blog_id + * @since 2.0.0 + */ +global $blog_id; + // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE. wp_initial_constants();