Make WordPress Core

Changeset 33652


Ignore:
Timestamp:
08/19/2015 07:32:04 PM (9 years ago)
Author:
boonebgorges
Message:

wp_update_term() should return a true integer for 'term_taxonomy_id'.

Props ipm-frommen.
Fixes #32876.

Location:
trunk
Files:
2 edited

Legend:

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

    r33646 r33652  
    35403540    }
    35413541
    3542     $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );
     3542    $tt_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );
    35433543
    35443544    // Check whether this is a shared term that needs splitting.
  • trunk/tests/phpunit/tests/term/wpUpdateTerm.php

    r33616 r33652  
    471471        $this->assertEquals( $term_by_id, $term_by_slug );
    472472        $this->assertEquals( $term_by_id, $term_by_ttid );
     473    }
     474
     475    /**
     476     * @ticket 32876
     477     */
     478    public function test_wp_update_term_should_return_int_values_for_term_id_and_term_taxonomy_id() {
     479        register_taxonomy( 'wptests_tax', 'post' );
     480        $t = $this->factory->term->create( array(
     481            'taxonomy' => 'wptests_tax',
     482        ) );
     483        $found = wp_update_term( $t, 'wptests_tax', array(
     484            'slug' => 'foo',
     485        ) );
     486
     487        $this->assertInternalType( 'int', $found['term_id'] );
     488        $this->assertInternalType( 'int', $found['term_taxonomy_id'] );
    473489    }
    474490
Note: See TracChangeset for help on using the changeset viewer.