Skip to content

Commit

Permalink
Merge pull request #788 from Automattic/fix/541-mustache-sub-issue-gb…
Browse files Browse the repository at this point in the history
…-vs-curlies
  • Loading branch information
GaryJones authored Aug 26, 2023
2 parents 92a8c82 + 22e31f7 commit 64aa799
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/Sniffs/Security/MustacheSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function register() {
*/
public function process_token( $stackPtr ) {

if ( strpos( $this->tokens[ $stackPtr ]['content'], '{{{' ) !== false || strpos( $this->tokens[ $stackPtr ]['content'], '}}}' ) !== false ) {
if ( strpos( $this->tokens[ $stackPtr ]['content'], '{{{' ) !== false && strpos( $this->tokens[ $stackPtr ]['content'], '}}}' ) !== false ) {
// Mustache unescaped output notation.
$message = 'Found Mustache unescaped output notation: "{{{}}}".';
$this->phpcsFile->addWarning( $message, $stackPtr, 'OutputNotation' );
Expand Down
5 changes: 4 additions & 1 deletion WordPressVIPMinimum/Tests/Security/MustacheUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ echo '<a href="{{href}}">{{&data}}</div></a>'; // NOK: data.

return new Handlebars.SafeString(result); // NOK: SafeString.
});
</script>
</script>

// Issue 541#issuecomment-1692323177: don't flag GB syntax.
<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 comments on commit 64aa799

Please sign in to comment.