Make WordPress Core


Ignore:
Timestamp:
08/26/2016 07:08:23 PM (10 years ago)
Author:
boonebgorges
Message:

Don't improperly cast IDs when fetching post, user, or term objects.

Blindly casting passed IDs to integers can generate false positives
when the ID is cast to 1.

Props deeptiboddapati.
Fixes #37738.

File:
1 edited

Legend:

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

    r38312 r38381  
    126126        global $wpdb;
    127127
     128        if ( ! is_numeric( $term_id ) || $term_id != floor( $term_id ) || ! $term_id ) {
     129            return false;
     130        }
     131
    128132        $term_id = (int) $term_id;
    129         if ( ! $term_id ) {
    130             return false;
    131         }
    132133
    133134        $_term = wp_cache_get( $term_id, 'terms' );
Note: See TracChangeset for help on using the changeset viewer.