WordPress.org

Make WordPress Core

Changeset 25384


Ignore:
Timestamp:
09/12/2013 05:08:33 AM (8 years ago)
Author:
wonderboymusic
Message:

Use reset() to access the first element of an array, don't assume there is an item at index 0.

See #25282.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r25351 r25384  
    12391239    $args['number'] = absint( $args['number'] );
    12401240    $args['offset'] = absint( $args['offset'] );
    1241     if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) ||
     1241    if ( !$single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) ||
    12421242        '' !== $args['parent'] ) {
    12431243        $args['child_of'] = 0;
  • trunk/tests/phpunit/tests/term/getTerms.php

    r25257 r25384  
    8686        $term_id = $this->factory->tag->create();
    8787        $terms = get_terms( array( '111' => 'post_tag' ), array( 'hide_empty' => false ) );
    88         $this->assertEquals( $term_id, $terms[0]->term_id );
     88        $this->assertEquals( $term_id, reset( $terms )->term_id );
    8989    }
    9090
Note: See TracChangeset for help on using the changeset viewer.