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 fd8d6b8

Browse filesBrowse files
author
Robin Chalas
committed
[Messenger] Fix undefined index on read timeout
1 parent e606ac1 commit fd8d6b8
Copy full SHA for fd8d6b8

File tree

2 files changed

+18
-2
lines changed
Filter options

2 files changed

+18
-2
lines changed

‎src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php
+17-1Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ public function testUnexpectedRedisError()
115115

116116
public function testGetAfterReject()
117117
{
118-
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget');
118+
$redis = new \Redis();
119+
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget', [], $redis);
119120
try {
120121
$connection->setup();
121122
} catch (TransportException $e) {
@@ -129,5 +130,20 @@ public function testGetAfterReject()
129130

130131
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget');
131132
$this->assertNotNull($connection->get());
133+
134+
$redis->del('messenger-rejectthenget');
135+
}
136+
137+
public function testBlockingTimeout()
138+
{
139+
$redis = new \Redis();
140+
$connection = Connection::fromDsn('redis://localhost/messenger-blockingtimeout', ['blocking_timeout' => 1], $redis);
141+
try {
142+
$connection->setup();
143+
} catch (TransportException $e) {
144+
}
145+
146+
$this->assertNull($connection->get());
147+
$redis->del('messenger-blockingtimeout');
132148
}
133149
}

‎src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function get(): ?array
102102
return $this->get();
103103
}
104104

105-
foreach ($messages[$this->stream] as $key => $message) {
105+
foreach ($messages[$this->stream] ?? [] as $key => $message) {
106106
$redisEnvelope = \json_decode($message['message'], true);
107107

108108
return [

0 commit comments

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