Skip to content

Commit

Permalink
Merge pull request #43 from danepowell/issue-42
Browse files Browse the repository at this point in the history
Fixed #42: Non-system exec calls incorrectly flagged.
  • Loading branch information
jmarcil authored Aug 4, 2019
2 parents b098ae9 + 4d8db12 commit 510be5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Security/Sniffs/BadFunctions/SystemExecFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public function process(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();

if (in_array($tokens[$stackPtr]['content'], $utils::getSystemexecFunctions())) {
if ($tokens[$stackPtr - 1]['code'] == T_OBJECT_OPERATOR) {
return;
}
$opener = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr, null, false, null, true);
$closer = $tokens[$opener]['parenthesis_closer'];
$s = $stackPtr + 1;
Expand Down

0 comments on commit 510be5c

Please sign in to comment.