123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- /*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
- use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
- /**
- * @author Drak <drak@zikula.org>
- */
- class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface
- {
- protected $handler;
- public function __construct(\SessionHandlerInterface $handler)
- {
- $this->handler = $handler;
- $this->wrapper = $handler instanceof \SessionHandler;
- $this->saveHandlerName = $this->wrapper || ($handler instanceof StrictSessionHandler && $handler->isWrapper()) ? \ini_get('session.save_handler') : 'user';
- }
- /**
- * @return \SessionHandlerInterface
- */
- public function getHandler()
- {
- return $this->handler;
- }
- // \SessionHandlerInterface
- /**
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function open($savePath, $sessionName)
- {
- return $this->handler->open($savePath, $sessionName);
- }
- /**
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function close()
- {
- return $this->handler->close();
- }
- /**
- * @return string|false
- */
- #[\ReturnTypeWillChange]
- public function read($sessionId)
- {
- return $this->handler->read($sessionId);
- }
- /**
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function write($sessionId, $data)
- {
- return $this->handler->write($sessionId, $data);
- }
- /**
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function destroy($sessionId)
- {
- return $this->handler->destroy($sessionId);
- }
- /**
- * @return int|false
- */
- #[\ReturnTypeWillChange]
- public function gc($maxlifetime)
- {
- return $this->handler->gc($maxlifetime);
- }
- /**
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function validateId($sessionId)
- {
- return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId);
- }
- /**
- * @return bool
- */
- #[\ReturnTypeWillChange]
- public function updateTimestamp($sessionId, $data)
- {
- return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data);
- }
- }
|