[wp-trac] [WordPress Trac] #59360: update_network_option() strict checks can cause false negatives

WordPress Trac noreply at wordpress.org
Fri Oct 13 08:18:37 UTC 2023


#59360: update_network_option() strict checks can cause false negatives
-------------------------------------------------+-------------------------
 Reporter:  mukesh27                             |       Owner:  joemcgill
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.4
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests has-patch commit      |     Focuses:
  dev-feedback                                   |  performance
-------------------------------------------------+-------------------------

Comment (by costdev):

 Update/summary on the BC break discovered during Yoast's test runs:
 - In 6.3, `update_network_option()` adds an option `if ( false ===
 $old_value )`. [https://github.com/WordPress/wordpress-
 develop/blob/6.3/src/wp-includes/option.php#L1834 Reference]
 - For parity with `update_option()`, we changed this to `if (
 $default_value === $raw_old_value )` [https://github.com/WordPress
 /wordpress-develop/blob/trunk/src/wp-includes/option.php#L2220 Reference].
   - `$raw_old_value` is fine, `$default_value` ''is not''.
 - This change caused failures in the Yoast test suite on multisite.
 [https://github.com/Yoast/wordpress-
 seo/actions/runs/6470608918/job/17567196156 Reference]
 - [https://github.com/WordPress/wordpress-develop/pull/5465 PR 5465]
 reverts this change, and updates our default value test (which was
 protecting this BC break) to ensure that `update_network_option()` ''does
 not'' add an option with a filtered default value. That is, the default
 value should have no bearing on whether the option is added.
   - This test was also run against the 6.3 branch on multisite and it
 passes as expected, showing that this is the expected behaviour to protect
 BC.

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


More information about the wp-trac mailing list