Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#8782 closed defect (bug) (fixed)

PHP warnings on admin-post/admin-ajax requests if plugins add menu's on the admin_init hook

Reported by: dd32's profile DD32 Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

WordPress emits PHP Warnings on admin-post/admin-ajax requests if plugins add menu pages on the same request.

It appears that menu.php is never included, and as such, foreach( $menu ... raises a warning, Casting these to an array beforehand fixes the warnings..

Attachments (1)

8782.diff (1.5 KB) - added by DD32 16 years ago.

Download all attachments as: .zip

Change History (3)

@DD32
16 years ago

#1 @DD32
16 years ago

  • Summary changed from PHP warnings on admin-post/admin-ajax requests to PHP warnings on admin-post/admin-ajax requests if plugins add menu's on the admin_init hook

Ah.. The plugin in question appears to be using the admin_init hook, Not admin_menu, which explains the warnings (as admin_menu would only be called if there are menu's).

Still, Seems like its a good idea to 'support' it.

#2 @azaozz
16 years ago

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

(In [10293]) Cast to array to silence warnings from plugin added menus, props DD32, fixes #8782

Note: See TracTickets for help on using tickets.