Skip to content

Commit

Permalink
Add a case to identify unescaped static method calls in the sniff
Browse files Browse the repository at this point in the history
  • Loading branch information
dingo-d committed Aug 28, 2023
1 parent 20d3d19 commit 2fd4721
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions WordPress/Sniffs/Security/EscapeOutputSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,14 @@ protected function check_code_is_escaped( $start, $end ) {

$content = $functionName;

// Check if it's static method call.
$double_colon = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), $end, true );
if ( false !== $double_colon
&& \T_DOUBLE_COLON === $this->tokens[ $double_colon ]['code']
) {
// Set the pointer to the end of the method.
$i = $this->phpcsFile->findNext( \T_CLOSE_PARENTHESIS, $i, $end );
}
} else {
$content = $this->tokens[ $i ]['content'];
$ptr = $i;
Expand Down

0 comments on commit 2fd4721

Please sign in to comment.