Opened 10 years ago
Closed 10 years ago
#39297 closed defect (bug) (fixed)
wrong return type in WP_User_Query::get_total()
| Reported by: | runciters | Owned by: | pento |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.8 |
| Component: | Users | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
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
@
10 years ago
- Component Database → Users
- Keywords needs-refresh added
- Milestone Awaiting Review → 4.8
- Version 4.7 → 3.1
#3
in reply to: ↑ 2
@
10 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thank you for the ticket and patch, @runciters!
The
$total_usersmember 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.