From c04ae32ff97e7df69dd49f7a0119866f2509ce28 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 31 Dec 2015 03:12:36 +0000 Subject: [PATCH] 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 --- src/wp-includes/widgets.php | 4 ++-- tests/phpunit/tests/widgets.php | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php index 848249170a..b24b465503 100644 --- a/src/wp-includes/widgets.php +++ b/src/wp-includes/widgets.php @@ -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; } diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index b864408f62..0ac6d9258d 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -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() */