[wp-trac] [WordPress Trac] #43368: Fix the warning of count() in php 7.2.0

WordPress Trac noreply at wordpress.org
Tue Feb 20 13:54:27 UTC 2018


#43368: Fix the warning of count() in php 7.2.0
------------------------------+-----------------------------
 Reporter:  vtrois            |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Revisions         |    Version:  trunk
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 When the version of PHP was 7.2.0, count() will now yield a warning on
 invalid countable types passed to the array_or_countable parameter.

 /wp-includes/post-template.php

 Line:284

 {{{
 if ( $page > count( $pages ) )
      $page = count( $pages );
 }}}

 to

 {{{
 if ( $page > count( $pages ? : [] ) )
      $page = count( $pages ? : [] );
 }}}

 https://github.com/WordPress/WordPress/pull/349

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


More information about the wp-trac mailing list