[wp-trac] [WordPress Trac] #28701: Deleted option is not deleted if value was ever null

WordPress Trac noreply at wordpress.org
Fri Sep 4 21:00:32 UTC 2015


#28701: Deleted option is not deleted if value was ever null
--------------------------------+------------------------------
 Reporter:  rmccue              |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  2.2
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:
--------------------------------+------------------------------

Comment (by boonebgorges):

 This needs unit tests.

 The change suggested in [28701.diff] seems innocuous to me, but it also
 doesn't seem to address the root problem. At a glance, it looks to me like
 we ought to fix the cache-busting logic in `update_option()`. It currently
 does this:

 {{{
         if ( ! defined( 'WP_INSTALLING' ) ) {
                 $alloptions = wp_load_alloptions();
                 if ( isset( $alloptions[$option] ) ) {
                         $alloptions[ $option ] = $serialized_value;
                         wp_cache_set( 'alloptions', $alloptions, 'options'
 );
                 } else {
                         wp_cache_set( $option, $serialized_value,
 'options' );
                 }
         }

 }}}

 But maybe (a) that first `isset()` should be `array_key_exists()`, and
 maybe (b) we should be more aggressive about invalidating both possible
 cache locations. (Though I want to careful about messing with 'alloptions'
 concurrency issues.)

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


More information about the wp-trac mailing list