You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In generate stage I set expirationHops to 1. Validation stage can be executed many times and will always output bool(true).
I dive into the code and find the cause.
In class Zend\Captcha\AbstractWord (line 253)
/** * Get session object * * @throws Exception\InvalidArgumentException * @return Container */publicfunctiongetSession()
{
if (! isset($this->session) || (null === $this->session)) {
$id = $this->getId();
if (! class_exists($this->sessionClass)) {
thrownewException\InvalidArgumentException("Session class $this->sessionClass not found");
}
$this->session = new$this->sessionClass('Zend_Form_Captcha_' . $id);
$this->session->setExpirationHops(1, null);
$this->session->setExpirationSeconds($this->getTimeout());
}
return$this->session;
}
In validation stage "$this->session->setExpirationHops(1, null);" will reset expirationHops. But expirationHops will not take effect in the same request. So after isValid() hops will always be 1.
The bug can recur very easily.
In generate stage I set expirationHops to 1. Validation stage can be executed many times and will always output bool(true).
I dive into the code and find the cause.
In class Zend\Captcha\AbstractWord (line 253)
In validation stage "$this->session->setExpirationHops(1, null);" will reset expirationHops. But expirationHops will not take effect in the same request. So after isValid() hops will always be 1.
Originally posted by @ares333 at zendframework/zend-captcha#37
The text was updated successfully, but these errors were encountered: