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

WordPress Trac noreply at wordpress.org
Tue Jun 30 22:04:48 UTC 2015


#32848: Null values for Update Options does not reset in $all_options
--------------------------+-----------------------------
 Reporter:  MikeNGarrett  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Cache API     |    Version:  4.2.2
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+-----------------------------
 This is a fun, extremely niche case.

 We were using the Settings API to save out options for a plugin when we
 came across a really frustrating scenario. Half the time our setting was
 returning values that were not accurate to the setting that was stored in
 the database and in cache.

 Come to find, the value being returned from wp_load_alloptions was
 incorrect while every other instance was correct. In our case, these
 values were in the database, memcache, and the single value in wp-object-
 cache.

 On [https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-
 includes/option.php#L319 "line 319 of option.php"], we're using isset to
 check the value in the array. This returns false if the value is NULL.
 This leads to all kinds of sadness.

 I would propose we instead use `array_key_exists` here to ensure we're
 getting true if the key is present in the array at all.

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


More information about the wp-trac mailing list