Widgets: Revert [34465], as it introduced a regression, making the $index argument of dynamic_sidebar() case-sensitive.

Fixes #34995 for trunk. See #23423.

git-svn-id: https://develop.svn.wordpress.org/trunk@36130 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-12-31 03:12:36 +00:00
parent a9dcce7060
commit c04ae32ff9
2 changed files with 2 additions and 19 deletions

View File

@ -616,9 +616,9 @@ function dynamic_sidebar( $index = 1 ) {
if ( is_int( $index ) ) {
$index = "sidebar-$index";
} else {
$sanitized_index = sanitize_title( $index );
$index = sanitize_title( $index );
foreach ( (array) $wp_registered_sidebars as $key => $value ) {
if ( sanitize_title( $value['name'] ) == $sanitized_index ) {
if ( sanitize_title( $value['name'] ) == $index ) {
$index = $key;
break;
}

View File

@ -535,23 +535,6 @@ class Tests_Widgets extends WP_UnitTestCase {
$this->assertArrayNotHasKey( 2, $option_value );
}
/**
* @ticket 23423
*/
function test_dynamic_sidebar_id_special_characters() {
wp_widgets_init();
register_sidebar( array(
'name' => 'Sidebar 2',
'id' => 'sidebar-2',
) );
ob_start();
$result = dynamic_sidebar( 'Sidebar 1' );
ob_end_clean();
$this->assertFalse( $result );
}
/**
* @see wp_widget_control()
*/