// A plugin's visitors should not override visit() unless they need to.
/**
* @param Node $node a
* A node of kind ast\AST_INCLUDE_OR_EVAL to analyze
* @override
*/
publicfunctionvisitIncludeOrEval(Node$node):void
{
if($node->flags!==ast\flags\EXEC_EVAL){
return;
}
$this->emitPluginIssue(
$this->code_base,
$this->context,
'PhanPluginUnsafeEval',
'eval() is often unsafe and may have better alternatives such as closures and is unanalyzable. Suppress this issue if you are confident that input is properly escaped for this use case and there is no better way to do this.',
'This syntax for shell_exec() ({CODE}) is easily confused for a string and does not allow proper exit code/stderr handling, and is used with a non-constant. Consider proc_open() instead.',
[ASTReverter::toShortString($node)]
);
return;
}
$this->emitPluginIssue(
$this->code_base,
$this->context,
'PhanPluginUnsafeShellExec',
'This syntax for shell_exec() ({CODE}) is easily confused for a string and does not allow proper exit code/stderr handling. Consider proc_open() instead.',
[ASTReverter::toShortString($node)]
);
}
}
// Every plugin needs to return an instance of itself at the