From 627e7a56d3bf14f03cb1754842720d19f2710dab Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 24 Sep 2015 00:30:24 +0000 Subject: [PATCH] Widgets: when passing a string arg value to `dynamic_sidebar()`, don't reset `$index` when the arg's sanitized value matches the sanitized name of a sidebar. Adds unit test. Props tyxla, fjarrett. Fixes #23423. Built from https://develop.svn.wordpress.org/trunk@34465 git-svn-id: http://core.svn.wordpress.org/trunk@34429 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/widget-functions.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index b5ec665056..8f556c511c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34464'; +$wp_version = '4.4-alpha-34465'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widget-functions.php b/wp-includes/widget-functions.php index c7d46158c1..eac11f03a6 100644 --- a/wp-includes/widget-functions.php +++ b/wp-includes/widget-functions.php @@ -501,15 +501,15 @@ function wp_unregister_widget_control($id) { * @param int|string $index Optional, default is 1. Index, name or ID of dynamic sidebar. * @return bool True, if widget sidebar was found and called. False if not found or not called. */ -function dynamic_sidebar($index = 1) { +function dynamic_sidebar( $index = 1 ) { global $wp_registered_sidebars, $wp_registered_widgets; - if ( is_int($index) ) { + if ( is_int( $index ) ) { $index = "sidebar-$index"; } else { - $index = sanitize_title($index); + $sanitized_index = sanitize_title( $index ); foreach ( (array) $wp_registered_sidebars as $key => $value ) { - if ( sanitize_title($value['name']) == $index ) { + if ( sanitize_title( $value['name'] ) == $sanitized_index ) { $index = $key; break; }