WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/04/2009 04:29:28 AM (13 years ago)
Author:
azaozz
Message:

Cast to array to silence warnings from plugin added menus, props DD32, fixes #8782

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r10267 r10293  
    624624    // this case, don't automatically add a link back to avoid duplication.
    625625    if (!isset( $submenu[$parent] ) && $file != $parent  ) {
    626         foreach ( $menu as $parent_menu ) {
     626        foreach ( (array)$menu as $parent_menu ) {
    627627            if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
    628628                $submenu[$parent][] = $parent_menu;
     
    722722
    723723    if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
    724         foreach ( $menu as $parent_menu ) {
     724        foreach ( (array)$menu as $parent_menu ) {
    725725            if ( $parent_menu[2] == $plugin_page ) {
    726726                $parent_file = $plugin_page;
     
    745745    }
    746746
    747     foreach (array_keys( $submenu ) as $parent) {
     747    foreach (array_keys( (array)$submenu ) as $parent) {
    748748        foreach ( $submenu[$parent] as $submenu_array ) {
    749749            if ( isset( $_wp_real_parent_file[$parent] ) )
     
    781781
    782782    if ( empty ( $parent) ) {
    783         foreach ( $menu as $menu_array ) {
     783        foreach ( (array)$menu as $menu_array ) {
    784784            if ( isset( $menu_array[3] ) ) {
    785785                if ( $menu_array[2] == $pagenow ) {
Note: See TracChangeset for help on using the changeset viewer.