[wp-trac] [WordPress Trac] #46346: WP_List_Table calculates total_pages as a float

WordPress Trac noreply at wordpress.org
Wed Jan 27 01:04:33 UTC 2021


#46346: WP_List_Table calculates total_pages as a float
----------------------------+-----------------------------
 Reporter:  lev0            |       Owner:  SergeyBiryukov
     Type:  defect (bug)    |      Status:  reviewing
 Priority:  normal          |   Milestone:  5.7
Component:  Administration  |     Version:
 Severity:  minor           |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+-----------------------------

Comment (by lev0):

 Replying to [comment:12 jrf]:
 > I FULLY understand the problem and the underlying intricacies of
 floating point calculations, but by your response you show that YOU don't.

 Your suggested solution indicated the opposite:

 > Otherwise, an alternative solution would be:
 > {{{
 > <?php
 > $args['total_pages'] = (int) round( ceil( $args['total_items'] /
 $args['per_page'] ), 0); // Using round to prevent floating point issues.
 > }}}


 You answered none of my questions about comment:10. Accept the patch or
 don't, I can work around the bug.

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


More information about the wp-trac mailing list