N°6002 - Explicitly add symfony/http-foundation and symfony/http-kernel to composer.json for easier lib update

This commit is contained in:
Molkobain
2023-02-22 22:38:15 +01:00
parent d997e36de0
commit 826fbe10c8
28 changed files with 262 additions and 144 deletions

View File

@@ -29,17 +29,28 @@ class Store implements StoreInterface
private $keyCache;
/** @var array<string, resource> */
private $locks = [];
private $options;
/**
* Constructor.
*
* The available options are:
*
* * private_headers Set of response headers that should not be stored
* when a response is cached. (default: Set-Cookie)
*
* @throws \RuntimeException
*/
public function __construct(string $root)
public function __construct(string $root, array $options = [])
{
$this->root = $root;
if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) {
throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
}
$this->keyCache = new \SplObjectStorage();
$this->options = array_merge([
'private_headers' => ['Set-Cookie'],
], $options);
}
/**
@@ -216,6 +227,10 @@ class Store implements StoreInterface
$headers = $this->persistResponse($response);
unset($headers['age']);
foreach ($this->options['private_headers'] as $h) {
unset($headers[strtolower($h)]);
}
array_unshift($entries, [$storedEnv, $headers]);
if (!$this->save($key, serialize($entries))) {