Opened 6 years ago
Closed 6 years ago
#44140 closed defect (bug) (duplicate)
Php7.2 error in post-template.php after upgrang to 4.9.6 - propose fix
Reported by: | TeroSalminen | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
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! :)
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @TeroSalminen, welcome to WordPress Trac!
Thanks for the report, we're already tracking this issue in #42814.