PHP

PHP Code Analysis

Posted on

  • *[http://www.program-transformation.org/PHP/PhpSat PHP-sat: PHP static analysis tool]
  • *[http://www.owasp.org/index.php/Category:OWASP_SWAAT_Project Category:OWASP SWAAT Project]
  • *[http://www.fortifysoftware.com/security-resources/rats.jsp 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:

<?php
function foo () {
$isStatic = !(isset($this) && get_class($this) == __CLASS__);
}
?>