Closed nickdaugherty closed 9 years ago
CodeCheck
is only meant as a base class for checks that are run on PHP code; BaseScanner
has a conditional to make sure that classes derived from CodeCheck
are given pre-parsed ('analyzed') PHP files only, while any other files are passed to classes derived from BaseCheck
.
Did this error occur when checking any particular theme? (Just trying to reproduce...)
https://github.com/Automattic/vip-scanner/blob/f9da641a12fd8704f20be9c9e3fcfba5f0b35ad4/vip-scanner/class-code-check.php#L53
Here, the
$php_file
in the loop is an array offilename
=>(string) contents
...which causes a fatal error when we try to call$php_file->get_node_tree()
on the non-object. I think we're missing some glue somewhere...Should we really be treating all code as PHP code here? Many files go through this function, including CSS, JS, .DS_Store, etc.
This happens in at least the following classes:
DeprecatedConstantsCheck
DeprecatedFunctionsCheck
DeprecatedParametersCheck
VIPRestrictedClassesCheck
VIPRestrictedCommandsCheck
VIPParametersCheck
cc @ockham