Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/wp-includes/ms-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@
wp_load_core_site_options( $site_id );
}

$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php.
$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
$table_prefix = $wpdb->get_blog_prefix();
if ( isset( $wpdb ) ) {
if ( isset( $table_prefix ) ) {
$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php.
}
$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
$table_prefix = $wpdb->get_blog_prefix();
}
Comment thread
huzaifaalmesbah marked this conversation as resolved.
Outdated
$_wp_switched_stack = array();
$switched = false;

Expand Down
4 changes: 2 additions & 2 deletions src/wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
include WP_CONTENT_DIR . '/advanced-cache.php';

// Re-initialize any hooks added manually by advanced-cache.php.
if ( $wp_filter ) {
if ( ! empty( $wp_filter ) ) {
Copy link
Copy Markdown

@Ninos Ninos Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May use isset() instead?

if ( isset( $wp_filter ) ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be not the same though. Before it was checking for a truthy value, which is what ! empty() does. On the other hand, isset() would return true for an empty array.

Copy link
Copy Markdown

@Ninos Ninos Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, true! I'm just trying to avoid non-strict type functions like empty() :D Following should also be possible, but what u prefer :-)

Suggested change
if ( ! empty( $wp_filter ) ) {
if ( $wp_filter ?? null ) {

$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
}
}
Expand Down Expand Up @@ -140,7 +140,7 @@
*
* @global string $table_prefix The database table prefix.
*/
if ( ! isset( $GLOBALS['table_prefix'] ) ) {
if ( ! isset( $GLOBALS['table_prefix'] ) && isset( $table_prefix ) ) {
Comment thread
huzaifaalmesbah marked this conversation as resolved.
Outdated
$GLOBALS['table_prefix'] = $table_prefix;
}

Expand Down
Loading