Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#19848 closed defect (bug) (invalid)

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

Reported by: matslundberg's profile matslundberg Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.1
Component: Multisite Keywords: has-patch reporter-feedback
Focuses: Cc:

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 13 years ago.
Changed $current_blog->blog_id to $current_blog->id
is_main_site1.diff (369 bytes) - added by tw2113 13 years ago.
Got too reckless and changed too much, sorry. Use this diff

Download all attachments as: .zip

Change History (9)

#1 @mohanjith
13 years ago

  • Cc moha@… added

@tw2113
13 years ago

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

#2 @tw2113
13 years ago

  • Keywords has-patch added

@tw2113
13 years ago

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

#3 @SergeyBiryukov
13 years ago

  • 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?

#4 @mohanjith
13 years ago

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.

#5 @matslundberg
13 years ago

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.

#6 @mohanjith
13 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#7 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.