Skip to content

Commit 64aa799

Browse files
authored
Merge pull request #788 from Automattic/fix/541-mustache-sub-issue-gb-vs-curlies
2 parents 92a8c82 + 22e31f7 commit 64aa799

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

WordPressVIPMinimum/Sniffs/Security/MustacheSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function register() {
4545
*/
4646
public function process_token( $stackPtr ) {
4747

48-
if ( strpos( $this->tokens[ $stackPtr ]['content'], '{{{' ) !== false || strpos( $this->tokens[ $stackPtr ]['content'], '}}}' ) !== false ) {
48+
if ( strpos( $this->tokens[ $stackPtr ]['content'], '{{{' ) !== false && strpos( $this->tokens[ $stackPtr ]['content'], '}}}' ) !== false ) {
4949
// Mustache unescaped output notation.
5050
$message = 'Found Mustache unescaped output notation: "{{{}}}".';
5151
$this->phpcsFile->addWarning( $message, $stackPtr, 'OutputNotation' );

WordPressVIPMinimum/Tests/Security/MustacheUnitTest.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ echo '<a href="{{href}}">{{&data}}</div></a>'; // NOK: data.
1717

1818
return new Handlebars.SafeString(result); // NOK: SafeString.
1919
});
20-
</script>
20+
</script>
21+
22+
// Issue 541#issuecomment-1692323177: don't flag GB syntax.
23+
<div class="wp-block-group"><!-- wp:heading {"textAlign":"center","style":{"spacing":{"margin":{"top":"0","right":"0","bottom":"var:preset|spacing|medium","left":"0"}}}} --><!-- OK. -->

0 commit comments

Comments
 (0)