[wp-trac] [WordPress Trac] #32848: Null values for Update Options does not reset in $all_options

WordPress Trac noreply at wordpress.org
Wed Apr 10 15:50:46 UTC 2024


#32848: Null values for Update Options does not reset in $all_options
-------------------------------------------------+-------------------------
 Reporter:  MikeNGarrett                         |       Owner:  pbearne
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:
Component:  Cache API                            |     Version:  4.2.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests bulk-     |     Focuses:
  reopened                                       |  performance
-------------------------------------------------+-------------------------

Comment (by MikeNGarrett):

 It's been a minute, so let me wrap my head around this.

 The original issue is that in the case of `$options = array('test' =>
 null);` that `isset($options['test'])` returns `false`, leading to
 differences in the structure of the options array.

 I just checked out 6.5.2
 (https://core.trac.wordpress.org/browser/tags/6.5.2/src/wp-
 includes/option.php) and it looks like this issue still exists.

 I think adding a secondary check for `array_key_exists()` after `isset()`
 would work wonderfully without slowing down execution in most
 circumstances.

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


More information about the wp-trac mailing list