WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#43368 closed defect (bug) (duplicate)

Fix the warning of count() in php 7.2.0

Reported by: vtrois Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.1
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

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

Attachments (1)

post-template.php (57.4 KB) - added by vtrois 4 years ago.

Download all attachments as: .zip

Change History (3)

@vtrois
4 years ago

#1 @swissspidy
4 years ago

  • Focuses coding-standards removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there and thanks for your report!

Please note that this is already being tracked in #42814.

#2 @SergeyBiryukov
4 years ago

  • Component changed from Revisions to Posts, Post Types
Note: See TracTickets for help on using tickets.