Skip to:
Content

BuddyPress.org

Changeset 2576 for trunk/bp-core.php


Ignore:
Timestamp:
02/03/2010 09:06:27 PM (16 years ago)
Author:
apeatling
Message:

Fixes #1551 - also safeguarded all foreach loops with an array typecast.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r2525 r2576  
    730730        return false;
    731731
    732     foreach ( $bp->bp_nav as $slug => $nav_item ) {
     732    foreach ( (array)$bp->bp_nav as $slug => $nav_item ) {
    733733        if ( empty( $temp[$nav_item['position']]) )
    734734            $temp[$nav_item['position']] = $nav_item;
     
    809809        return false;
    810810
    811     foreach ( $bp->bp_options_nav as $parent_slug => $subnav_items ) {
     811    foreach ( (array)$bp->bp_options_nav as $parent_slug => $subnav_items ) {
    812812        if ( !is_array( $subnav_items ) )
    813813            continue;
    814814
    815         foreach ( $subnav_items as $subnav_item ) {
     815        foreach ( (array)$subnav_items as $subnav_item ) {
    816816            if ( empty( $temp[$subnav_item['position']]) )
    817817                $temp[$subnav_item['position']] = $subnav_item;
     
    847847    /* Unset subnav items for this nav item */
    848848    if ( is_array( $bp->bp_options_nav[$parent_id] ) ) {
    849         foreach( $bp->bp_options_nav[$parent_id] as $subnav_item ) {
     849        foreach( (array)$bp->bp_options_nav[$parent_id] as $subnav_item ) {
    850850            bp_core_remove_subnav_item( $parent_id, $subnav_item['slug'] );
    851851        }
     
    15821582
    15831583    if ( is_array( $current ) ) {
    1584         foreach( $bp_illegal_names as $bp_illegal_name ) {
     1584        foreach( (array)$bp_illegal_names as $bp_illegal_name ) {
    15851585            if ( !in_array( $bp_illegal_name, $current ) )
    15861586                $current[] = $bp_illegal_name;
     
    20072007    global $wpdb;
    20082008
    2009     foreach( $comments as $comment ) {
     2009    foreach( (array)$comments as $comment ) {
    20102010        if ( $comment->user_id )
    20112011            $user_ids[] = $comment->user_id;
     
    20202020        return $comments;
    20212021
    2022     foreach( $userdata as $user )
     2022    foreach( (array)$userdata as $user )
    20232023        $users[$user->user_id] = bp_core_get_user_domain( $user->user_id, $user->user_nicename, $user->user_login );
    20242024
    2025     foreach( $comments as $i => $comment ) {
     2025    foreach( (array)$comments as $i => $comment ) {
    20262026        if ( !empty( $comment->user_id ) ) {
    20272027            if ( !empty( $users[$comment->user_id] ) )
Note: See TracChangeset for help on using the changeset viewer.