[wp-trac] [WordPress Trac] #46660: PHP Warning: count()

WordPress Trac noreply at wordpress.org
Mon Apr 8 05:52:53 UTC 2019

#46660: PHP Warning:  count()
 Reporter:  betimademi                   |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  reopened
 Priority:  normal                       |   Milestone:  Future Release
Component:  Options, Meta APIs           |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:
Changes (by pento):

 * keywords:  has-patch => has-patch reporter-feedback
 * milestone:  5.2 => Future Release


 Thank you for the patch, @shashwatmittal!

 Before we commit it, however, I'd like to know how to reproduce this
 error: after a bit of debugging, I was unable to determine how
 `get_metadata()` was returning a non-array value when it's called in
 `update_metadata()`. If there's something causing the the meta cache to
 become corrupted, for example, we need to fix that, rather than paper over

 @betimademi: Could I get you to add this to your `wp-config.php` file?

         function( $errno, $errstr, $errfile, $errline ) {
                 error_log( "PHP Warning: $errstr in $errofile on line
 $errline" );
                 error_log( print_r( debug_backtrace(), true ) );
                 return true;

 This will add the stack trace to your PHP log when an error occurs. I
 recommend you monitor your log file size carefully, as this extra logging
 could cause it to fill up very quickly.

 Once you have the stack trace related to the original warning, please post
 it to this ticket, so we can investigate further.

Ticket URL: <https://core.trac.wordpress.org/ticket/46660#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list