Open Journal Systems  3.3.0
WriteCheckSessionHandler.php
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
13 
19 class WriteCheckSessionHandler implements \SessionHandlerInterface
20 {
24  private $wrappedSessionHandler;
25 
29  private $readSessions;
30 
31  public function __construct(\SessionHandlerInterface $wrappedSessionHandler)
32  {
33  $this->wrappedSessionHandler = $wrappedSessionHandler;
34  }
35 
39  public function close()
40  {
41  return $this->wrappedSessionHandler->close();
42  }
43 
47  public function destroy($sessionId)
48  {
49  return $this->wrappedSessionHandler->destroy($sessionId);
50  }
51 
55  public function gc($maxlifetime)
56  {
57  return $this->wrappedSessionHandler->gc($maxlifetime);
58  }
59 
63  public function open($savePath, $sessionName)
64  {
65  return $this->wrappedSessionHandler->open($savePath, $sessionName);
66  }
67 
71  public function read($sessionId)
72  {
73  $session = $this->wrappedSessionHandler->read($sessionId);
74 
75  $this->readSessions[$sessionId] = $session;
76 
77  return $session;
78  }
79 
83  public function write($sessionId, $data)
84  {
85  if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) {
86  return true;
87  }
88 
89  return $this->wrappedSessionHandler->write($sessionId, $data);
90  }
91 }
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\read
read($sessionId)
Definition: WriteCheckSessionHandler.php:77
Symfony\Component\HttpFoundation\Session\Storage\Handler
Definition: lib/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php:12
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\write
write($sessionId, $data)
Definition: WriteCheckSessionHandler.php:89
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler
Definition: WriteCheckSessionHandler.php:19
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\destroy
destroy($sessionId)
Definition: WriteCheckSessionHandler.php:53
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\open
open($savePath, $sessionName)
Definition: WriteCheckSessionHandler.php:69
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\__construct
__construct(\SessionHandlerInterface $wrappedSessionHandler)
Definition: WriteCheckSessionHandler.php:37
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\gc
gc($maxlifetime)
Definition: WriteCheckSessionHandler.php:61
Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler\close
close()
Definition: WriteCheckSessionHandler.php:45