| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; |
| 13 |
|
| 14 |
use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface |
| 20 |
{ |
| 21 |
public function __construct( |
| 22 |
protected \SessionHandlerInterface $handler, |
| 23 |
) { |
| 24 |
$this->wrapper = $handler instanceof \SessionHandler; |
| 25 |
$this->saveHandlerName = $this->wrapper || ($handler instanceof StrictSessionHandler && $handler->isWrapper()) ? \ini_get('session.save_handler') : 'user'; |
| 26 |
} |
| 27 |
|
| 28 |
public function getHandler(): \SessionHandlerInterface |
| 29 |
{ |
| 30 |
return $this->handler; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public function open(string $savePath, string $sessionName): bool |
| 36 |
{ |
| 37 |
return $this->handler->open($savePath, $sessionName); |
| 38 |
} |
| 39 |
|
| 40 |
public function close(): bool |
| 41 |
{ |
| 42 |
return $this->handler->close(); |
| 43 |
} |
| 44 |
|
| 45 |
public function read(#[\SensitiveParameter] string $sessionId): string|false |
| 46 |
{ |
| 47 |
return $this->handler->read($sessionId); |
| 48 |
} |
| 49 |
|
| 50 |
public function write(#[\SensitiveParameter] string $sessionId, string $data): bool |
| 51 |
{ |
| 52 |
return $this->handler->write($sessionId, $data); |
| 53 |
} |
| 54 |
|
| 55 |
public function destroy(#[\SensitiveParameter] string $sessionId): bool |
| 56 |
{ |
| 57 |
return $this->handler->destroy($sessionId); |
| 58 |
} |
| 59 |
|
| 60 |
public function gc(int $maxlifetime): int|false |
| 61 |
{ |
| 62 |
return $this->handler->gc($maxlifetime); |
| 63 |
} |
| 64 |
|
| 65 |
public function validateId(#[\SensitiveParameter] string $sessionId): bool |
| 66 |
{ |
| 67 |
return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId); |
| 68 |
} |
| 69 |
|
| 70 |
public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool |
| 71 |
{ |
| 72 |
return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data); |
| 73 |
} |
| 74 |
} |