[wp-trac] [WordPress Trac] #42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284

WordPress Trac noreply at wordpress.org
Wed Mar 28 16:47:14 UTC 2018


#42814: PHP 7.2 Warning: ...wp-includes/post-template.php on line 284
-------------------------------+-----------------------
 Reporter:  internetwerk       |       Owner:
     Type:  defect (bug)       |      Status:  reopened
 Priority:  normal             |   Milestone:  4.9.6
Component:  Posts, Post Types  |     Version:  4.5
 Severity:  normal             |  Resolution:
 Keywords:  has-patch          |     Focuses:
-------------------------------+-----------------------

Comment (by tasmer):

 Hello, I get the same issue on 4.9.1 with PHP 7.2.1.

 In my case I call `get_the_excerpt ()` from the hook `wp_head` and I get
 this warning when the excerpt is empty.

 The same observation as @Kelderic and @gsarig

 We should set the global $pages to an empty array if is null, because
 `get_the_excerpt` can be call outside the main loop.

 `$pages = is_array ($pages)? $pages: array ();`

 at line 262 of post-template. PHP (inside the `get_the_content` function)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42814#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list