Opened 2 years ago
Last modified 2 years ago
#55442 new defect (bug)
count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 319
Reported by: | davidscpl | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | reporter-feedback |
Focuses: | template | Cc: |
Description
Call get_the_content() with no arguments and $post is null. If post is null then this is ran:
$elements = compact( 'page', 'more', 'preview', 'pages', 'multipage' );
Associate array has keys with null values. Then on lin3 319 is
if ( $elements['page'] > count( $elements['pages'] ) ) {
Which causes this notice:
Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 319 Notice: Trying to access array offset on value of type null in /var/www/html/wp-includes/post-template.php on line 325
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hello and welcome to WordPress Trac @davidscpl,
I tried to reproduce the issue using the following steps, but it didn't succeed.
It echoes
NULL
(line 2). No PHP warning.Could you please provide more details on how we can reproduce the issue?
Thanks!