From 239759914f236783409d65d32cd69d65c357e62f Mon Sep 17 00:00:00 2001 From: ocean90 Date: Sun, 9 Aug 2015 20:48:02 +0000 Subject: [PATCH] Shortcodes: Trim whitespace after sanitizing the shortcode output. props Ankit K Gupta, obenland, miqrogroove. fixes #33259. git-svn-id: https://develop.svn.wordpress.org/trunk@33600 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/shortcodes.php | 2 +- tests/phpunit/tests/shortcode.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/shortcodes.php b/src/wp-includes/shortcodes.php index d16227ea3c..a34f530620 100644 --- a/src/wp-includes/shortcodes.php +++ b/src/wp-includes/shortcodes.php @@ -399,7 +399,7 @@ function do_shortcodes_in_html_tags( $content, $ignore_html ) { if ( $count > 0 ) { // Sanitize the shortcode output using KSES. $new_attr = wp_kses_one_attr( $new_attr, $elname ); - if ( '' !== $new_attr ) { + if ( '' !== trim( $new_attr ) ) { // The shortcode is safe to use now. $attr = $new_attr; } diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php index 44abc2754f..c43313c61a 100644 --- a/tests/phpunit/tests/shortcode.php +++ b/tests/phpunit/tests/shortcode.php @@ -418,6 +418,14 @@ EOF; '