Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#19848 closed defect (bug) (invalid)

Function is_main_site uses $current_site->blog_id instead of $current_site->id

Reported by: matslundberg Owned by:
Priority: normal Milestone:
Component: Multisite Version: 3.3.1
Severity: normal Keywords: has-patch reporter-feedback
Cc: moha@…

Description

The function is_main_site uses $current_site->blog_id to compare if current blog is main site, should instead use $current_site->id. The $current_site->blog_id is not defined. $current_site (from what I can tell) loaded from table wp_site, which doesn't contain any blog_id column.

This leads to issues when trying the registration form for MS sites. I get a redirection-loop for a MS installation.

Attachments (2)

is_main_site.diff (420 bytes) - added by tw2113 16 months ago.
Changed $current_blog->blog_id to $current_blog->id
is_main_site1.diff (369 bytes) - added by tw2113 16 months ago.
Got too reckless and changed too much, sorry. Use this diff

Download all attachments as: .zip

Change History (9)

  • Cc moha@… added

Changed $current_blog->blog_id to $current_blog->id

  • Keywords has-patch added

Got too reckless and changed too much, sorry. Use this diff

  • Keywords reporter-feedback added

$current_site->blog_id is defined in wpmu_current_site() and in ms-settings.php:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/ms-load.php#L145
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/ms-settings.php#L47

It's also used in several more places. If it's undefined in your case, I guess we should find the underlying problem. I've just checked wp-signup.php on my install, and $current_site->blog_id is defined there.

Could you describe the steps to reproduce the redirection loop on a clean install?

This is normal when you upgrade from old WordPress MU installs (2.8.x) and do not update wp-config.php to bring it inline with new configurations.

If you defined BLOG_ID_CURRENT_SITE and SITE_ID_CURRENT_SITE in wp-config.php issue will go away.

Yes, this is not a bug but for me it was type-o in a drop-in sunrise.php which made this variable undefined. Thanks for your help, and sorry for the bother.

This issue is resolved.

  • Resolution set to invalid
  • Status changed from new to closed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.