for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Nip_Form_Element_Hash extends Nip_Form_Element_Hidden
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
protected $_ID;
public function init()
parent::init();
$this->initSession();
}
public function initSession()
$name = $this->getSessionName();
if (!$_SESSION[$name]) {
$this->reset();
$this->setValue($this->getSessionValue());
public function reset()
$hash = $this->_generateHash();
$_SESSION[$name] = $hash;
$this->setValue($hash);
public function validate()
if (!$this->getValue()) {
$this->getValue()
Nip\Form\Elements\AbstractElement::getValue()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
$this->addError('Request received without security hash');
} elseif ($this->getValue() != $this->getSessionValue()) {
$this->addError('Form security hash different from server');
public function getSessionName()
return $this->getForm()->getName().'_'.$this->getSalt();
public function getSessionValue()
return $_SESSION[$name];
public function getSalt()
return sha1(__CLASS__);
protected function _generateHash()
return md5(
mt_rand(1, 1000000)
.$this->getSalt()
.$this->getName()
$this->getName()
Nip\Form\Elements\AbstractElement::getName()
.session_id()
.mt_rand(1, 1000000)
);
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.