Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#31755 closed defect (bug) (fixed)

Notice in admin-bar.php since revision 31448

Reported by: deconf's profile deconf Owned by: jeremyfelt's profile jeremyfelt
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description

PHP Notice: Trying to get property of non-object in \path\wp-includes\admin-bar.php on line 335

If a Super Admin has no sites, active_blog is empty and the above notice is thrown.

Attachments (4)

admin-bar.php.patch (549 bytes) - added by deconf 10 years ago.
31755.patch (768 bytes) - added by SergeyBiryukov 10 years ago.
31755.2.patch (533 bytes) - added by deconf 10 years ago.
31755.3.patch (556 bytes) - added by deconf 10 years ago.

Download all attachments as: .zip

Change History (10)

#1 @deconf
10 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.2

Introduced in [31445], changed in [31448].

#3 @DrewAPicture
10 years ago

  • Owner set to jeremyfelt
  • Status changed from new to reviewing

@jeremyfelt: Mind taking a gander at this?

@deconf
10 years ago

@deconf
10 years ago

#5 @jeremyfelt
10 years ago

  • Status changed from reviewing to accepted

I think I like the approach in 31755.patch as opposed to the inline ternary.

I can test and get this in tonight.

#6 @jeremyfelt
10 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 31981:

Check for an active blog before generating the my-sites.php URL.

If a super admin does not have an active blog assigned to their account, $wp_admin_bar->user->active_blog will be set as null. We can then fall back to admin_url() to generate the My Sites URL.

Props SergeyBiryukov, deconf.

Fixes #31755.

Note: See TracTickets for help on using tickets.