Opened 4 years ago
Closed 2 months ago
#55442 closed defect (bug) (worksforme)
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: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 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 (6)
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
2 months ago
#6
@
2 months ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
Since no one has been able to reproduce this and more than 4 years have passed since then, it's time to close this as worksforme
@davidscpl feel free to comment if you can provide additional information on how to reproduce this, and I will be happy to reopen and test it accordingly.
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!