Make WordPress Core


Ignore:
Timestamp:
02/20/2017 06:49:11 AM (8 years ago)
Author:
dd32
Message:

Customize: Ensure root values are accessible in multidimensional custom setting types.

Fixes bad conditions in WP_Customize_Setting::get_root_value() and WP_Customize_Setting::set_root_value().

Props dlh, westonruter.
Amends [35007].
Merges [40036] to the 4.7 branch.
See #32103.
Fixes #36952.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/customize/setting.php

    r39318 r40088  
    403403            'sanitize_callback' => array( $this->manager->nav_menus, 'intval_base10' ),
    404404        ) );
     405
     406        /*
     407         * In #36952 the conditions were such that get_theme_mod() be erroneously used
     408         * to source the root value for a custom multidimensional type.
     409         * Add a theme mod with the same name as the custom setting to test fix.
     410         */
     411        set_theme_mod( $setting_id, 999 );
    405412        $this->assertSame( 123, $setting->value() );
     413
    406414        $this->manager->set_post_value( $setting_id, '456' );
    407415        $setting->preview();
     
    409417
    410418        unset( $this->custom_type_data_previewed, $this->custom_type_data_saved );
     419        remove_theme_mod( $setting_id );
    411420    }
    412421
Note: See TracChangeset for help on using the changeset viewer.