Skip to:
Content

BuddyPress.org

Changeset 6096


Ignore:
Timestamp:
06/14/2012 06:12:35 PM (13 years ago)
Author:
boonebgorges
Message:

Ensures consistent typing when core components register themselves in active array

When core components register themselves in the active_components array using
a boolean, it causes problems with the array_search() logic in
bp_is_current_component(). By using the int 1 instead, we avoid false positives
from array_search(), and thus from bp_is_current_component().

Fixes #4081.

Props chrisbliss18, cnorris23

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-loader.php

    r6093 r6096  
    7878
    7979            // Setup the active components
    80             $active_components     = array_flip( array_diff( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), array_values( $bp->deactivated_components ) ) );
    81 
    82             // Loop through active components and set the values
    83             $bp->active_components = array_map( '__return_true', $active_components );
     80            $active_components     = array_fill_keys( array_diff( array_values( array_merge( $optional_components, $required_components ) ), array_values( $deactivated_components ) ), '1' );
    8481
    8582            // Set the active component global
     
    9390
    9491            // Setup the active components
    95             $active_components     = array_flip( array_values( array_merge( $bp->optional_components, $bp->required_components ) ) );
    96 
    97             // Loop through active components and set the values
    98             $bp->active_components = array_map( '__return_true', $active_components );
     92            $active_components     = array_fill_keys( array_values( array_merge( $bp->optional_components, $bp->required_components ) ), '1' );
    9993
    10094            // Set the active component global
Note: See TracChangeset for help on using the changeset viewer.