Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#31755 closed defect (bug) (fixed)

Notice in admin-bar.php since revision 31448

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

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 12 years ago.
31755.patch​ (768 bytes ) - added by SergeyBiryukov 12 years ago.
31755.2.patch​ (533 bytes ) - added by deconf 12 years ago.
31755.3.patch​ (556 bytes ) - added by deconf 12 years ago.

Download all attachments as: .zip

Change History (10)

#1 @deconf
12 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review → 4.2

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

#3 @DrewAPicture
12 years ago

  • Owner set to jeremyfelt
  • Status new → reviewing

@jeremyfelt: Mind taking a gander at this?

#5 @jeremyfelt
12 years ago

  • Status reviewing → 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
12 years ago

  • Resolution → fixed
  • Status accepted → 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.