WordPress.org

Make WordPress Core

Ticket #47395: 47395.diff

File 47395.diff, 614 bytes (added by mukesh27, 3 months ago)

Added is_countable function for PHP 7.3

  • wp-includes/meta.php

    diff --git a/wp-includes/meta.php b/wp-includes/meta.php
    index 2332d9b5af..18d1f7fe73 100644
    a b function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_ 
    207207        // Compare existing value to new value if no prev value given and the key exists only once.
    208208        if ( empty( $prev_value ) ) {
    209209                $old_value = get_metadata( $meta_type, $object_id, $meta_key );
    210                 if ( count( $old_value ) == 1 ) {
     210                if ( is_countable( $old_value ) && 1 === count( $old_value ) ) {
    211211                        if ( $old_value[0] === $meta_value ) {
    212212                                return false;
    213213                        }