[wp-trac] [WordPress Trac] #44140: Php7.2 error in post-template.php after upgrang to 4.9.6 - propose fix

WordPress Trac noreply at wordpress.org
Fri May 18 05:09:05 UTC 2018


#44140: Php7.2 error in post-template.php after upgrang to 4.9.6 - propose fix
--------------------------+-----------------------------
 Reporter:  TeroSalminen  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 After upgrading to 4.9.6 php7.2 throws an error:


 {{{
 2018/05/18 07:44:49 [error] 10262#10262: *60929 FastCGI sent in stderr:
 "PHP message: PHP Warning:  count(): Parameter must be an array or an
 object that implements Countable in /var/www/blog/wp-includes/post-te
 mplate.php on line 284" while reading response header from upstream,
 client: xxx.xxx.xxx.xxx, server: www.rc-thoughts.com, request: "GET /diy-
 sensor-faq/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.2-fpm.s
 ock:", host: "www.rc-thoughts.com", referrer: "https://www.rc-
 thoughts.com/"
 }}}

 Line 284 is:

 {{{
 if ( $page > count( $pages ) ) // if the requested page doesn't exist
 }}}

 Adding a line before it makes an empty array count needs if $pages is
 empty:


 {{{
 if (empty($pages)) $pages = [];
 if ( $page > count( $pages ) ) // if the requested page doesn't exist
 }}}

 No more errors :)

 (This is my first bug-report, be gentle if something is wrongly reported!
 :)

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


More information about the wp-trac mailing list