Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#43368 closed defect (bug) (duplicate)

Fix the warning of count() in php 7.2.0

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

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 9 years ago.

Download all attachments as: .zip

Change History (3)

#1 @swissspidy
9 years ago

  • Focuses coding-standards removed
  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Hi there and thanks for your report!

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

#2 @SergeyBiryukov
9 years ago

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