Skip to content

Commit 510be5c

Browse files
authored
Merge pull request #43 from danepowell/issue-42
Fixed #42: Non-system exec calls incorrectly flagged.
2 parents b098ae9 + 4d8db12 commit 510be5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Security/Sniffs/BadFunctions/SystemExecFunctionsSniff.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public function process(File $phpcsFile, $stackPtr) {
3030
$tokens = $phpcsFile->getTokens();
3131

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

0 commit comments

Comments
 (0)