[wp-trac] [WordPress Trac] #39297: wrong return type in WP_User_Query::get_total()

WordPress Trac noreply at wordpress.org
Mon Jan 16 23:23:08 UTC 2017


#39297: wrong return type in WP_User_Query::get_total()
--------------------------------------+---------------------
 Reporter:  runciters                 |       Owner:  pento
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  4.8
Component:  Users                     |     Version:  3.1
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------
Changes (by pento):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"39915"]:
 {{{
 #!CommitTicketReference repository="" revision="39915"
 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.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39297#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list