Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/AbstractWord.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ abstract class AbstractWord extends AbstractAdapter
* @var bool
*/
protected $keepSession = false;

/**
* Is using default session?
*
* @var bool
*/
protected $useDefaultSession = true;

/**#@+
* Error codes
Expand Down Expand Up @@ -250,8 +257,6 @@ public function getSession()
throw new Exception\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;
}
Expand All @@ -265,6 +270,7 @@ public function getSession()
public function setSession(Container $session)
{
$this->session = $session;
$this->useDefaultSession = false;
if ($session) {
$this->keepSession = true;
}
Expand Down Expand Up @@ -294,6 +300,10 @@ public function getWord()
protected function setWord($word)
{
$session = $this->getSession();
if ($this->useDefaultSession) {
$session->setExpirationHops(1, null);
$session->setExpirationSeconds($this->getTimeout());
}
$session->word = $word;
$this->word = $word;
return $this;
Expand Down