Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0366a32

Browse filesBrowse files
committed
[HttpFoundation] Accept Relay connection
1 parent a4c2ca8 commit 0366a32
Copy full SHA for 0366a32

File tree

Expand file treeCollapse file tree

5 files changed

+36
-2
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+36
-2
lines changed

‎src/Symfony/Component/HttpFoundation/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Add `ParameterBag::getEnum()`
88
* Create migration for session table when pdo handler is used
9+
* Add support for Relay PHP extension for Redis
910

1011
6.2
1112
---

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
1313

1414
use Predis\Response\ErrorInterface;
15+
use Relay\Relay;
1516

1617
/**
1718
* Redis based session storage handler based on the Redis class
@@ -39,7 +40,7 @@ class RedisSessionHandler extends AbstractSessionHandler
3940
* @throws \InvalidArgumentException When unsupported client or options are passed
4041
*/
4142
public function __construct(
42-
private \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis,
43+
private \Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis,
4344
array $options = [],
4445
) {
4546
if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) {

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/SessionHandlerFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/SessionHandlerFactory.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
1313

1414
use Doctrine\DBAL\DriverManager;
15+
use Relay\Relay;
1516
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1617

1718
/**
@@ -32,6 +33,7 @@ public static function createHandler(object|string $connection, array $options =
3233

3334
switch (true) {
3435
case $connection instanceof \Redis:
36+
case $connection instanceof Relay:
3537
case $connection instanceof \RedisArray:
3638
case $connection instanceof \RedisCluster:
3739
case $connection instanceof \Predis\ClientInterface:

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Relay\Relay;
1516
use Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler;
1617

1718
/**
1819
* @requires extension redis
20+
*
1921
* @group time-sensitive
2022
*/
2123
abstract class AbstractRedisSessionHandlerTestCase extends TestCase
@@ -32,7 +34,7 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase
3234
*/
3335
protected $redisClient;
3436

35-
abstract protected function createRedisClient(string $host): \Redis|\RedisArray|\RedisCluster|\Predis\Client;
37+
abstract protected function createRedisClient(string $host): \Redis|Relay|\RedisArray|\RedisCluster|\Predis\Client;
3638

3739
protected function setUp(): void
3840
{
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Session\Storage\Handler;
13+
14+
use Relay\Relay;
15+
use Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\AbstractRedisSessionHandlerTestCase;
16+
17+
/**
18+
* @requires extension relay
19+
*
20+
* @group integration
21+
*/
22+
class RelaySessionHandlerTest extends AbstractRedisSessionHandlerTestCase
23+
{
24+
protected function createRedisClient(string $host): Relay
25+
{
26+
return new Relay(...explode(':', $host));
27+
}
28+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.