WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#19642 closed defect (bug) (fixed)

Toolbar shows a warning on a second call

Reported by: SergeyBiryukov Owned by: ryan
Milestone: 3.3.1 Priority: normal
Severity: normal Version: 3.3
Component: Toolbar Keywords: has-patch commit
Focuses: Cc:

Description

Slight regression from 3.2.

After upgrading to 3.3, some people saw the warning near the Toolbar:

Notice: Trying to get property of non-object in wp-includes/class-wp-admin-bar.php on line 342
Warning: Invalid argument supplied for foreach() in wp-includes/class-wp-admin-bar.php on line 342

This happens if a theme has two wp_footer() calls, or both do_action('wp_footer') and wp_footer() (which of course is wrong and weird, but didn't produce a warning in 3.2).

The problem is that $wp_admin_bar->render() doesn't check the result of _bind() (which returns nothing on a second call) before calling _render():
http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/class-wp-admin-bar.php#L197

Attachments (1)

19642.patch (429 bytes) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (4)

@SergeyBiryukov4 years ago

comment:1 @nacin4 years ago

In [19638]:

Make sure that _render() is only called with a valid root object. As in, render() can only be validly called once and must not fail on the second call. props SergeyBiryukov, see #19642 for trunk.

comment:2 @nacin4 years ago

  • Keywords commit added

Marking as commit for the 3.3 branch, after additional review.

comment:3 @ryan4 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [19644]:

Make sure that _render() is only called with a valid root object. As in, render() can only be validly called once and must not fail on the second call. props SergeyBiryukov, fixes #19642 for 3.3

Note: See TracTickets for help on using tickets.