PHP Code Analysis

Posted on

  • *[ PHP-sat: PHP static analysis tool]
  • *[ Category:OWASP SWAAT Project]
  • *[ RATS – Rough Auditing Tool for Security]


Determining if a method was called statically

Posted on

In PHP, it’s occasionally helpful to call a method sometimes statically and sometimes from class instance. Figuring out which way a method has been called is pretty straightforward, thanks to a function posted in the PHP documentation:

function foo () {
$isStatic = !(isset($this) && get_class($this) == __CLASS__);