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 6554077

Browse filesBrowse files
[Cache] Fix Redis6Proxy
1 parent ea20845 commit 6554077
Copy full SHA for 6554077

File tree

4 files changed

+13
-14
lines changed
Filter options

4 files changed

+13
-14
lines changed

‎src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ public function testRelayProxy()
8787
public function testRedis6Proxy($class, $stub)
8888
{
8989
if (version_compare(phpversion('redis'), '6.0.0', '<')) {
90-
$this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable');
91-
9290
$stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php");
9391
$stub = preg_replace('/^class /m', 'return; \0', $stub);
9492
$stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1);
@@ -108,7 +106,7 @@ public function testRedis6Proxy($class, $stub)
108106
continue;
109107
}
110108
$return = $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
111-
$methods[] = "\n ".ProxyHelper::exportSignature($method, false, $args)."\n".<<<EOPHP
109+
$methods[] = "\n ".str_replace('timeout = 0.0', 'timeout = 0', ProxyHelper::exportSignature($method, false, $args))."\n".<<<EOPHP
112110
{
113111
{$return}(\$this->lazyObjectState->realInstance ??= (\$this->lazyObjectState->initializer)())->{$method->name}({$args});
114112
}

‎src/Symfony/Component/Cache/Traits/Redis6Proxy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/Redis6Proxy.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function config($operation, $key_or_settings = null, $value = null): mixe
181181
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->config(...\func_get_args());
182182
}
183183

184-
public function connect($host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, $context = null): bool
184+
public function connect($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool
185185
{
186186
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->connect(...\func_get_args());
187187
}
@@ -686,12 +686,12 @@ public function object($subcommand, $key): \Redis|false|int|string
686686
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->object(...\func_get_args());
687687
}
688688

689-
public function open($host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, $context = null): bool
689+
public function open($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool
690690
{
691691
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->open(...\func_get_args());
692692
}
693693

694-
public function pconnect($host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, $context = null): bool
694+
public function pconnect($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool
695695
{
696696
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pconnect(...\func_get_args());
697697
}
@@ -736,7 +736,7 @@ public function pipeline(): \Redis|bool
736736
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pipeline(...\func_get_args());
737737
}
738738

739-
public function popen($host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0, $context = null): bool
739+
public function popen($host, $port = 6379, $timeout = 0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0, $context = null): bool
740740
{
741741
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->popen(...\func_get_args());
742742
}

‎src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testKeepGettingPendingMessages()
118118
$redis = $this->createMock(\Redis::class);
119119

120120
$redis->expects($this->exactly(3))->method('xreadgroup')
121-
->with('symfony', 'consumer', ['queue' => 0], 1, null)
121+
->with('symfony', 'consumer', ['queue' => 0], 1, 1)
122122
->willReturn(['queue' => [['message' => json_encode(['body' => 'Test', 'headers' => []])]]]);
123123

124124
$connection = Connection::fromDsn('redis://localhost/queue', [], $redis);
@@ -212,7 +212,7 @@ public function testGetPendingMessageFirst()
212212
$redis = $this->createMock(\Redis::class);
213213

214214
$redis->expects($this->exactly(1))->method('xreadgroup')
215-
->with('symfony', 'consumer', ['queue' => '0'], 1, null)
215+
->with('symfony', 'consumer', ['queue' => '0'], 1, 1)
216216
->willReturn(['queue' => [['message' => '{"body":"1","headers":[]}']]]);
217217

218218
$connection = Connection::fromDsn('redis://localhost/queue', [], $redis);
@@ -237,11 +237,11 @@ public function testClaimAbandonedMessageWithRaceCondition()
237237
->willReturnCallback(function (...$args) {
238238
static $series = [
239239
// first call for pending messages
240-
[['symfony', 'consumer', ['queue' => '0'], 1, null], []],
240+
[['symfony', 'consumer', ['queue' => '0'], 1, 1], []],
241241
// second call because of claimed message (redisid-123)
242-
[['symfony', 'consumer', ['queue' => '0'], 1, null], []],
242+
[['symfony', 'consumer', ['queue' => '0'], 1, 1], []],
243243
// third call because of no result (other consumer claimed message redisid-123)
244-
[['symfony', 'consumer', ['queue' => '>'], 1, null], []],
244+
[['symfony', 'consumer', ['queue' => '>'], 1, 1], []],
245245
];
246246

247247
[$expectedArgs, $return] = array_shift($series);
@@ -273,9 +273,9 @@ public function testClaimAbandonedMessage()
273273
->willReturnCallback(function (...$args) {
274274
static $series = [
275275
// first call for pending messages
276-
[['symfony', 'consumer', ['queue' => '0'], 1, null], []],
276+
[['symfony', 'consumer', ['queue' => '0'], 1, 1], []],
277277
// second call because of claimed message (redisid-123)
278-
[['symfony', 'consumer', ['queue' => '0'], 1, null], ['queue' => [['message' => '{"body":"1","headers":[]}']]]],
278+
[['symfony', 'consumer', ['queue' => '0'], 1, 1], ['queue' => [['message' => '{"body":"1","headers":[]}']]]],
279279
];
280280

281281
[$expectedArgs, $return] = array_shift($series);

‎src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ public function get(): ?array
353353
$this->group,
354354
$this->consumer,
355355
[$this->stream => $messageId],
356+
1,
356357
1
357358
);
358359
} catch (\RedisException|\Relay\Exception $e) {

0 commit comments

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