[wp-trac] [WordPress Trac] #40293: Comment template - warning

WordPress Trac noreply at wordpress.org
Wed Mar 29 07:16:02 UTC 2017


#40293: Comment template - warning
---------------------------+-----------------------------
 Reporter:  victorfreitas  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Comments       |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Hi,

 in the `comments_template` function, you are entering a divide-by-zero
 condition at line '''1379''' of the `wp-includes/comment-template.php`
 file.


 The line described above is like this.

 {{{#!php
 <?php
 $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) *
 $per_page;
 ?>
 }}}


 I believe this will solve.

 {{{#!php
 <?php
 $offset = 0;

 if ( $top_level_count && $per_page ) {
     $offset = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
 }

 $comment_args['offset'] = $offset;
 ?>
 }}}

 I'm using a default install with theme Twenty Seventeen.


 Thank you!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40293>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list