WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/16/2017 11:23:06 PM (4 years ago)
Author:
pento
Message:

User Query: Cast $user_total as an int.

The $user_total member of WP_User_Query, and corresponding get_total() method, have always been documented as returning an int. $user_total, however, is populated by $wpdb->get_var(), which returns
a string (containing an integer value). Casting the return value from get_var() as an int rectifies this discrepency.

Props runciters.
Fixes #39297.

File:
1 edited

Legend:

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

    r38768 r39915  
    613613         */
    614614        if ( isset( $qv['count_total'] ) && $qv['count_total'] )
    615             $this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
     615            $this->total_users = (int) $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
    616616
    617617        if ( !$this->results )
Note: See TracChangeset for help on using the changeset viewer.