Skip to content

Instantly share code, notes, and snippets.

@manuelpichler
Created November 25, 2011 15:08
Show Gist options
  • Save manuelpichler/1393734 to your computer and use it in GitHub Desktop.
Save manuelpichler/1393734 to your computer and use it in GitHub Desktop.
Detecting super globals
...
private $_superGlobals = array(
'$GLOBALS',
'$_SERVER',
'$_GET',
...
);
public function apply(PHP_PMD_AbstractNode $node)
{
foreach ($node->findChildrenOfType('ASTVariable') as $variable) {
if (in_array($variable->getImage(), $variable->getImage())) {
$this->addViolation($goto, array($node->getType(), $node->getImage()));
}
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment