Skip to:
Content

BuddyPress.org

Ticket #6615: 6615.01.patch

File 6615.01.patch, 924 bytes (added by dcavins, 10 years ago)

Add strict check on result of array_search() in bp_get_the_post_class().

  • src/bp-core/bp-core-template.php

    diff --git src/bp-core/bp-core-template.php src/bp-core/bp-core-template.php
    index 54fe156..88b150b 100644
    function bp_get_the_post_class( $wp_classes = array() ) { 
    30243024        // removes the 'page' and 'type-page' post classes
    30253025        // we need to remove these classes since they did not exist before we switched
    30263026        // theme compat to use the 'page' post type
    3027         $page_key      = array_search( 'page',      $wp_classes );
     3027        $page_key = array_search( 'page', $wp_classes );
     3028        if ( $page_key !== false ) {
     3029                unset( $wp_classes[$page_key] );
     3030        }
     3031
    30283032        $page_type_key = array_search( 'type-page', $wp_classes );
    3029         unset( $wp_classes[$page_key], $wp_classes[$page_type_key] );
     3033        if ( $page_type_key !== false ) {
     3034                unset( $wp_classes[$page_type_key] );
     3035        }
    30303036
    30313037        // okay let's merge!
    30323038        return array_unique( array_merge( $bp_classes, $wp_classes ) );