[wp-trac] [WordPress Trac] #55442: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 319

WordPress Trac noreply at wordpress.org
Tue Mar 22 21:59:34 UTC 2022


#55442: count(): Parameter must be an array or an object that implements Countable
in /var/www/html/wp-includes/post-template.php on line 319
--------------------------+-----------------------------
 Reporter:  davidscpl     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Call get_the_content() with no arguments and $post is null. If post is
 null then this is ran:
 {{{#!php
  $elements = compact( 'page', 'more', 'preview', 'pages', 'multipage' );
 }}}

 Associate array has keys with null values. Then on lin3 319 is
 {{{#!php
 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
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55442>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list