Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php (revision 28765)
+++ src/wp-includes/formatting.php (working copy)
@@ -203,7 +203,7 @@
. '|'
. '\[' // Find start of shortcode.
. '\[?' // Shortcodes may begin with [[
- . '[^\[\]<>]+' // Shortcodes do not contain other shortcodes or HTML elements.
+ . '[^\[\]]+' // Shortcodes do not contain other shortcodes. HTML recursion is permitted, but not texturized.
. '\]' // Find end of shortcode.
. '\]?' // Shortcodes may end with ]]
. ')/s';
@@ -220,12 +220,12 @@
_wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>' );
}
- } elseif ( '[' === $first && 1 === preg_match( '/^\[[^\[\]<>]+\]$/', $curl ) ) {
+ } elseif ( '[' === $first && 1 === preg_match( '/^\[[^\[\]]+\]$/', $curl ) ) {
// This is a shortcode delimeter.
_wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']' );
- } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?[^\[\]<>]+\]\]?$/', $curl ) ) {
+ } elseif ( '[' === $first && 1 === preg_match( '/^\[\[?[^\[\]]+\]\]?$/', $curl ) ) {
// This is an escaped shortcode delimeter.
// Do not texturize.
Index: tests/phpunit/tests/formatting/WPTexturize.php
===================================================================
--- tests/phpunit/tests/formatting/WPTexturize.php (revision 28765)
+++ tests/phpunit/tests/formatting/WPTexturize.php (working copy)
@@ -1146,6 +1146,10 @@
function data_tag_avoidance() {
return array(
array(
+ '[ is it wise to maybe ]',
+ '[ is it wise to this guy ]',
'[ photos by this guy ]',
),
@@ -1186,8 +1190,8 @@
'[code]...[/code]]...', // This test would not pass in 3.9 because the extra brace was always ignored by texturize.
),
array(
+ '[gal>ery ...]', // This is a potentially usable shortcode.
'[gal>ery ...]',
- '[gal>ery …]',
),
array(
'[gallery ...',
@@ -1194,8 +1198,8 @@
'[gallery …',
),
array(
+ '[gallery
...]', // This tag is still valid. Shortcode 'attributes' are not considered in the initial parsing of shortcodes, and HTML is allowed.
'[gallery
...]',
- '[gallery
…]',
),
array(
'
',
@@ -1234,8 +1238,8 @@
'[/gallery ...]]',
),
array(
+ '[[gallery
...]]', // This gets parsed as an escaped shortcode with embedded HTML. Brains may explode.
'[[gallery
...]]',
- '[[gallery
…]]',
),
array(
'
',