[wp-trac] [WordPress Trac] #46148: Error Countable | Post-Template

WordPress Trac noreply at wordpress.org
Wed Jan 30 13:57:26 UTC 2019


#46148: Error Countable | Post-Template
-------------------------------+-----------------------------
 Reporter:  alex0902           |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  trunk
 Severity:  major              |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 Hello,

 In some theme, it is possible to have a PHP error "count (): Parameter
 must be an array or an object that implements Countable", which is due to
 the code locate "wp-includes / post-template.php: 284" , it is correctable
 thanks to this code :

 {{{#!php
 <?php
     if ( is_array( $pages ) ) {
         if ( $page > count( $pages ) ) // if the requested page doesn't
 exist
             $page = count( $pages ); // give them the highest numbered
 page that DOES exist
     } else {
         $page = 0;
     }
 }}}

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


More information about the wp-trac mailing list