Skip to content

Commit

Permalink
Fixed #42: non-system exec calls incorrectly flagged.
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Jul 9, 2019
1 parent ea4120b commit 4d8db12
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 4d8db12

Please sign in to comment.