Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#43368 closed defect (bug) (duplicate)

Fix the warning of count() in php 7.2.0

Reported by: anonymized_15003776's profile anonymized_15003776 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 anonymized_15003776 7 years ago.

Download all attachments as: .zip

Change History (3)

#1 @swissspidy
7 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
7 years ago

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