12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
- class WriteCheckSessionHandler implements \SessionHandlerInterface
- {
-
- private $wrappedSessionHandler;
-
- private $readSessions;
- public function __construct(\SessionHandlerInterface $wrappedSessionHandler)
- {
- $this->wrappedSessionHandler = $wrappedSessionHandler;
- }
-
- public function close()
- {
- return $this->wrappedSessionHandler->close();
- }
-
- public function destroy($sessionId)
- {
- return $this->wrappedSessionHandler->destroy($sessionId);
- }
-
- public function gc($maxlifetime)
- {
- return $this->wrappedSessionHandler->gc($maxlifetime);
- }
-
- public function open($savePath, $sessionName)
- {
- return $this->wrappedSessionHandler->open($savePath, $sessionName);
- }
-
- public function read($sessionId)
- {
- $session = $this->wrappedSessionHandler->read($sessionId);
- $this->readSessions[$sessionId] = $session;
- return $session;
- }
-
- public function write($sessionId, $data)
- {
- if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) {
- return true;
- }
- return $this->wrappedSessionHandler->write($sessionId, $data);
- }
- }
|