WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#45430 closed defect (bug) (duplicate)

With PHP 7.2 - Warning error on wp-includes/post-template.php

Reported by: jtibbles Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.8
Component: Posts, Post Types Keywords: 2nd-opinion has-patch
Focuses: Cc:

Description

Following warning is displayed in code when viewing a single post, when using PHP7.2:

Warning
: count(): : count(): Parameter must be an array or an object that implements Countable in
/xxxx/wp-includes/post-template.php

Suggested patch ammend: replace line 284 in wp-includes/post-template.php:

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

...with the following:

if ( empty($pages) === false && $page > count( $pages ) ) if the requested page doesn't exist

Change History (1)

#1 @pento
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thank you for the bug report, @jtibbles! We're tracking this issue over on #42814.

Note: See TracTickets for help on using tickets.