Make WordPress Core

Ticket #38930: 38930.diff

File 38930.diff, 1.4 KB (added by joehoyle, 8 years ago)
  • src/wp-includes/option.php

     
    421421        $notoptions = wp_cache_get( 'notoptions', 'options' );
    422422        if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
    423423                /** This filter is documented in wp-includes/option.php */
    424                 if ( apply_filters( 'default_option_' . $option, false, $option ) !== get_option( $option ) )
     424                if ( apply_filters( 'default_option_' . $option, false, $option, false ) !== get_option( $option ) )
    425425                        return false;
    426426
    427427        $serialized_value = maybe_serialize( $value );
  • tests/phpunit/tests/option/registration.php

     
    6262        }
    6363
    6464        /**
     65         * @ticket 38930
     66         */
     67        public function test_add_option_with_no_options_cache() {
     68                register_setting( 'test_group', 'test_default', array(
     69                        'default' => 'My Default :)',
     70                ));
     71                wp_cache_delete( 'notoptions', 'options' );
     72                $this->assertTrue( add_option( 'test_default', 'hello' ) );
     73                $this->assertEquals( 'hello', get_option( 'test_default' ) );
     74        }
     75
     76        /**
    6577         * @expectedDeprecated register_setting
    6678         */
    6779        public function test_register_deprecated_group_misc() {