Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/21/2012 12:48:54 AM (14 years ago)
Author:
nacin
Message:

In bb_create_tag(), avoid calling list() on the insert_term() method of the taxonomy object, as this method may return WP_Error.

Calling list() on a WP_Error object would result in a fatal error. Instead, check for WP_Error before breaking up the return value.

props otto42. for bbPress 1.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1/bb-includes/functions.bb-topic-tags.php

    r2855 r3854  
    6666        return $tt_id;
    6767
    68     list($term_id, $tt_id) = $wp_taxonomy_object->insert_term( $tag, 'bb_topic_tag' );
    69 
    70     if ( is_wp_error($term_id) || is_wp_error($tt_id) || !$tt_id )
     68    $term = $wp_taxonomy_object->insert_term( $tag, 'bb_topic_tag' );
     69    if ( is_wp_error( $term ) )
     70        return false;
     71
     72    list( $term_id, $tt_id ) = $term;
     73    if ( ! $tt_id )
    7174        return false;
    7275
Note: See TracChangeset for help on using the changeset viewer.