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

WordPress Trac noreply at wordpress.org
Wed Jul 17 21:51:27 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:  6.7
Component:  Cache API                 |     Version:  4.2.2
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------

Comment (by pbearne):

 I looked at the code, and I could not find a way to check null in the
 functions, but I was able to confirm that the code change worked with this
 test.


 {{{#!php
 <?php
         /**
          * @ticket 32848
          *
          * Test that $options = array('test' => null); works.
          */
         public function test_for_null() {
                 $option = 'foo';
                 $this->assertTrue( add_option( $option, null, '',true  )
 );

                 $alloptions = wp_load_alloptions();
                 $this->assertFalse( isset( $alloptions[ $option ] ) );
                 $this->assertTrue( isset( $alloptions[ $option ] ) ||
 array_key_exists( $option, $alloptions ) );
         }

 }}}


 I can level this test in but it doesn't test function rather a fragment of
 code so it doesn't feel right

 Paul

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


More information about the wp-trac mailing list