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

WordPress Trac noreply at wordpress.org
Tue Mar 26 22:06:18 UTC 2019


#46660: PHP Warning:  count()
--------------------------------+-----------------------
 Reporter:  betimademi          |       Owner:  (none)
     Type:  defect (bug)        |      Status:  reopened
 Priority:  normal              |   Milestone:  5.2
Component:  Options, Meta APIs  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch         |     Focuses:
--------------------------------+-----------------------
Changes (by SergeyBiryukov):

 * component:  General => Options, Meta APIs


Old description:

> i have updated to the latest wordpress and php 7.3 but somehow i get this
> error over and over again
>
> PHP Warning:  count(): Parameter must be an array or an object that
> implements Countable in /srv/users/.../apps/.../public/wp-
> includes/meta.php on line 210:
>
> // Compare existing value to new value if no prev value given and the key
> exists only once.
>         if ( empty( $prev_value ) ) {
>                 $old_value = get_metadata( $meta_type, $object_id,
> $meta_key );
>                 if ( count( $old_value ) == 1 ) {
>                         if ( $old_value[0] === $meta_value ) {
>                                 return false;
>                         }
>                 }
>         }

New description:

 i have updated to the latest wordpress and php 7.3 but somehow i get this
 error over and over again
 {{{
 PHP Warning:  count(): Parameter must be an array or an object that
 implements Countable in /srv/users/.../apps/.../public/wp-
 includes/meta.php on line 210:

 // Compare existing value to new value if no prev value given and the key
 exists only once.
         if ( empty( $prev_value ) ) {
                 $old_value = get_metadata( $meta_type, $object_id,
 $meta_key );
                 if ( count( $old_value ) == 1 ) {
                         if ( $old_value[0] === $meta_value ) {
                                 return false;
                         }
                 }
         }
 }}}

--

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


More information about the wp-trac mailing list