Opened 8 years ago
Closed 8 years ago
#39297 closed defect (bug) (fixed)
wrong return type in WP_User_Query::get_total()
Reported by: | runciters | Owned by: | pento |
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Users | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
As stated here: https://developer.wordpress.org/reference/classes/wp_user_query/get_total/
WP_User_Query::get_total() method should return an integer value, but it returns a string value:
https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-user-query.php#L615
$total_users get its value from wpdb::get_var() which returns a string: https://github.com/WordPress/WordPress/blob/master/wp-includes/wp-db.php#L2270
Attachments (2)
Change History (7)
#2
follow-up:
↓ 3
@
8 years ago
- Component changed from Database to Users
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to 4.8
- Version changed from 4.7 to 3.1
#3
in reply to:
↑ 2
@
8 years ago
Thank you for your reply @pento!
Here's a new updated patch (I also added a test).
Note: See
TracTickets for help on using
tickets.
Thank you for the ticket and patch, @runciters!
The
$total_users
member is also supposed to be anint
, so I think the better method would be to cast the value that$wpdb->get_var()
returns asint
.If you'd like to update the patch, we can get this sorted.