bug #31544 [Messenger] Fix undefined index on read timeout (chalasr)
This PR was merged into the 4.3 branch.
Discussion
----------
[Messenger] Fix undefined index on read timeout
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
fd8d6b8187
[Messenger] Fix undefined index on read timeout
This commit is contained in:
commit
abefb53d7c
@ -115,7 +115,8 @@ class ConnectionTest extends TestCase
|
|||||||
|
|
||||||
public function testGetAfterReject()
|
public function testGetAfterReject()
|
||||||
{
|
{
|
||||||
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget');
|
$redis = new \Redis();
|
||||||
|
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget', [], $redis);
|
||||||
try {
|
try {
|
||||||
$connection->setup();
|
$connection->setup();
|
||||||
} catch (TransportException $e) {
|
} catch (TransportException $e) {
|
||||||
@ -129,5 +130,20 @@ class ConnectionTest extends TestCase
|
|||||||
|
|
||||||
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget');
|
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget');
|
||||||
$this->assertNotNull($connection->get());
|
$this->assertNotNull($connection->get());
|
||||||
|
|
||||||
|
$redis->del('messenger-rejectthenget');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testBlockingTimeout()
|
||||||
|
{
|
||||||
|
$redis = new \Redis();
|
||||||
|
$connection = Connection::fromDsn('redis://localhost/messenger-blockingtimeout', ['blocking_timeout' => 1], $redis);
|
||||||
|
try {
|
||||||
|
$connection->setup();
|
||||||
|
} catch (TransportException $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertNull($connection->get());
|
||||||
|
$redis->del('messenger-blockingtimeout');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ class Connection
|
|||||||
return $this->get();
|
return $this->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($messages[$this->stream] as $key => $message) {
|
foreach ($messages[$this->stream] ?? [] as $key => $message) {
|
||||||
$redisEnvelope = \json_decode($message['message'], true);
|
$redisEnvelope = \json_decode($message['message'], true);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
Reference in New Issue
Block a user