{"record":{"id":"92c140bf6f7a8692","repo":"symfony/http-foundation","slug":"the-following-options-are-not-supported-s-92c140","errorCode":null,"errorMessage":"The following options are not supported \"%s\".","messagePattern":"The following options are not supported \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Session/Storage/Handler/RedisSessionHandler.php","lineNumber":47,"sourceCode":"\n    /**\n     * Time to live in seconds.\n     */\n    private int|\\Closure|null $ttl;\n\n    /**\n     * List of available options:\n     *  * prefix: The prefix to use for the keys in order to avoid collision on the Redis server\n     *  * ttl: The time to live in seconds.\n     *\n     * @throws \\InvalidArgumentException When unsupported client or options are passed\n     */\n    public function __construct(\n        private \\Redis|Relay|\\RedisArray|\\RedisCluster|\\Predis\\ClientInterface $redis,\n        array $options = [],\n    ) {\n        if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) {\n            throw new \\InvalidArgumentException(\\sprintf('The following options are not supported \"%s\".', implode(', ', $diff)));\n        }\n\n        $this->prefix = $options['prefix'] ?? 'sf_s';\n        $this->ttl = $options['ttl'] ?? null;\n    }\n\n    protected function doRead(#[\\SensitiveParameter] string $sessionId): string\n    {\n        return $this->redis->get($this->prefix.$sessionId) ?: '';\n    }\n\n    protected function doWrite(#[\\SensitiveParameter] string $sessionId, string $data): bool\n    {\n        $ttl = ($this->ttl instanceof \\Closure ? ($this->ttl)() : $this->ttl) ?? \\ini_get('session.gc_maxlifetime');\n        $result = $this->redis->setEx($this->prefix.$sessionId, (int) $ttl, $data);\n\n        return $result && !$result instanceof ErrorInterface;\n    }","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/symfony/http-foundation/blob/5aea19cd678fa4140f6108406f1096de5e9ed6e4/Session/Storage/Handler/RedisSessionHandler.php#L29-L65","documentation":"RedisSessionHandler's constructor accepts only two options keys: 'prefix' (session key prefix, default 'sf_s') and 'ttl' (max lifetime override). Any other key in $options raises this InvalidArgumentException listing the unsupported keys. Unlike the PDO handler, the Redis handler does not take per-handler table/column or locking options.","triggerScenarios":"new RedisSessionHandler($redis, [...]) with any option other than 'prefix'/'ttl' — commonly copying PdoSessionHandler options like 'db_table', 'lock_mode', 'gc_maxlifetime', 'col_lifetime', or framework session config keys (cookie_lifetime, gc_maxlifetime) into the handler options array.","commonSituations":"Migrating from PdoSessionHandler to RedisSessionHandler and reusing the same options array; typos like 'preifx' or 'TTL' (options keys are case-sensitive); framework YAML config where handler options and session config are conflated.","solutions":["Keep only 'prefix' and 'ttl' keys in the options array; move other settings to the right place (session.gc_maxlifetime in php.ini/framework session config, storage schema options to the PDO handler).","Fix key casing/typos: exactly 'prefix' and 'ttl'.","If you need connection-level settings, configure them on the \\Redis/\\Predis client itself (timeout, database, auth), not the handler options.","Diff your options array against ['prefix','ttl'] (array_diff(array_keys($options), ['prefix','ttl'])) in a config test to catch this in CI."],"exampleFix":"// before\nnew RedisSessionHandler($redis, ['prefix' => 'sess:', 'db_table' => 'sessions']);\n\n// after\nnew RedisSessionHandler($redis, ['prefix' => 'sess:']);","handlingStrategy":"validation","validationCode":"$allowed = ['prefix', 'ttl'];\nif ($diff = array_diff(array_keys($options), $allowed)) {\n    throw new LogicException('RedisSessionHandler does not support options: ' . implode(', ', $diff));\n}","typeGuard":null,"tryCatchPattern":"try {\n    $handler = new RedisSessionHandler($redis, $options);\n} catch (\\InvalidArgumentException $e) {\n    if (str_contains($e->getMessage(), 'options are not supported')) {\n        $handler = new RedisSessionHandler($redis, array_intersect_key($options, ['prefix' => 1, 'ttl' => 1]));\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Keep a whitelist of ['prefix','ttl'] when building handler options","Do not reuse PdoSessionHandler option arrays with RedisSessionHandler","Watch for case-sensitive key typos ('prefix', 'ttl')","Configure connection settings on the Redis client object, not handler options"],"tags":["sessions","redis","configuration","invalid-argument","php"],"backgroundTag":"unsupported-config-value","analyzedSha":"5aea19cd678fa4140f6108406f1096de5e9ed6e4","analyzedAt":"2026-09-13T01:52:22.855Z","contentChangedAt":"2026-09-13T01:52:22.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}