[wp-trac] [WordPress Trac] #46346: WP_List_Table calculates total_pages as a float
WordPress Trac
noreply at wordpress.org
Mon Jan 25 18:41:07 UTC 2021
#46346: WP_List_Table calculates total_pages as a float
----------------------------+------------------------------
Reporter: lev0 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: minor | Resolution:
Keywords: has-patch | Focuses:
----------------------------+------------------------------
Comment (by sabernhardt):
Thanks for the report!
The [https://www.php.net/manual/en/function.ceil.php ceil() function]
*should* always round up any remainder.
1. Is there a way that the current `ceil()` function calculates an
incorrect page count?
2. If the return value is always correct but needs conversion to the
integer type, could adding the `(int)` type cast suffice?
{{{
$args['total_pages'] = (int) ceil( $args['total_items'] /
$args['per_page'] );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46346#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list