Make WordPress Core


Ignore:
Timestamp:
10/05/2023 04:13:38 PM (3 years ago)
Author:
flixos90
Message:

Options, Meta APIs: Fix minor compatibility issue with update_option() change.

When calling update_option() with value false on a non-existent option, prior to [56681] the function would have returned false and not stored the value in the database, since the given value was the same as the default.

The aforementioned changeset broke that promise with good intention, however this particular change was a backward compatibility break and therefore is resolved here.

Props mukesh27, costdev.
Fixes #22192.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r56717 r56788  
    806806         * See https://core.trac.wordpress.org/ticket/38903 and https://core.trac.wordpress.org/ticket/22192.
    807807         */
    808         if ( $raw_old_value !== $default_value && _is_equal_database_value( $raw_old_value, $value ) ) {
     808        if (
     809                $value === $raw_old_value ||
     810                (
     811                        $raw_old_value !== $default_value &&
     812                        _is_equal_database_value( $raw_old_value, $value )
     813                )
     814        ) {
    809815                return false;
    810816        }
Note: See TracChangeset for help on using the changeset viewer.