diff --git a/_build/test/Tests/Model/modParserTest.php b/_build/test/Tests/Model/modParserTest.php
index 474f8dbd6a5..545264f8258 100644
--- a/_build/test/Tests/Model/modParserTest.php
+++ b/_build/test/Tests/Model/modParserTest.php
@@ -646,6 +646,140 @@ public function providerProcessElementTags() {
'depth' => 0
]
],
+ [
+ // Various tests for literal brackets [] in the modifier
+ [
+ 'processed' => 1,
+ 'content' => "[]"
+ ],
+ "[[+tag1:notempty=`[]`]]",
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 0
+ ]
+ ],
+ [
+ // Test for literal []'s not being broken things
+ [
+ 'processed' => 1,
+ 'content' => "[ ][ ]"
+ ],
+ "[[+tag1:notempty=`[ ][ ]`]]",
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 0
+ ]
+ ],
+ [
+ [
+ 'processed' => 1,
+ 'content' => "["
+ ],
+ "[[+tag1:notempty=`[`]]",
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 0
+ ]
+ ],
+ [
+ [
+ 'processed' => 1,
+ 'content' => "["
+ ],
+ "[[!+tag1:notempty=`[`]]",
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 0
+ ]
+ ],
+ [
+ [
+ 'processed' => 1,
+ 'content' => "]"
+ ],
+ "[[+tag1:notempty=`]`]]",
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 0
+ ]
+ ],
+ [
+ // various special characters in the modifier
+ [
+ 'processed' => 1,
+ 'content' => "]=:["
+ ],
+ "[[+tag1:notempty=`]=:[`]]",
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 0
+ ]
+ ],
+ [
+ // tags within brackets
+ [
+ 'processed' => 1,
+ 'content' => ''
+ ],
+ '[[+tag1:notempty=``]]',
+ [
+ 'parentTag' => '',
+ 'processUncacheable' => true,
+ 'removeUnprocessed' => false,
+ 'prefix' => '[[',
+ 'suffix' => ']]',
+ 'tokens' => [],
+ 'depth' => 1
+ ]
+ ],
+ // tags directly within brackets
+ // @todo this test fails
+// [
+// [
+// 'processed' => 1,
+// 'content' => ''
+// ],
+// '[[+tag1:notempty=``]]',
+// [
+// 'parentTag' => '',
+// 'processUncacheable' => true,
+// 'removeUnprocessed' => false,
+// 'prefix' => '[[',
+// 'suffix' => ']]',
+// 'tokens' => [],
+// 'depth' => 1
+// ]
+// ],
];
}
diff --git a/core/src/Revolution/Filters/modInputFilter.php b/core/src/Revolution/Filters/modInputFilter.php
index 56ed666d86b..a303c65ca57 100644
--- a/core/src/Revolution/Filters/modInputFilter.php
+++ b/core/src/Revolution/Filters/modInputFilter.php
@@ -72,11 +72,11 @@ public function filter(&$element)
case '[':
if ($chars[$i + 1] === '[') {
$depth++;
- $depth === 0 ? $command .= $char.$char : $commandModifiers .= $char.$char;
+ $inModifier ? $commandModifiers .= $char.$char : $command .= $char.$char;
$skipNext = true;
}
else {
- $depth === 0 ? $command .= $char : $commandModifiers .= $char;
+ $inModifier ? $commandModifiers .= $char : $command .= $char;
}
break;
@@ -84,12 +84,12 @@ public function filter(&$element)
// The character is added to either the command or the commandModifiers
case ']':
if ($chars[$i + 1] === ']') {
- $depth === 0 ? $command .= $char.$char : $commandModifiers .= $char.$char;
+ $inModifier ? $commandModifiers .= $char.$char : $command .= $char.$char;
$depth--;
$skipNext = true;
}
else {
- $depth === 0 ? $command .= $char : $commandModifiers .= $char;
+ $inModifier ? $commandModifiers .= $char : $command .= $char;
}
break;
@@ -110,7 +110,7 @@ public function filter(&$element)
$inModifier = !$inModifier;
}
else {
- $commandModifiers .= $char;
+ $inModifier ? $commandModifiers .= $char : $command .= $char;
}
break;
// The `:` sign (colon) is a separator between multiple commands in a string.