mirror of
https://github.com/predis/predis.git
synced 2026-08-30 04:02:22 +00:00
fix XREAD parse null response (#1563)
Co-authored-by: aleksanders <alexander.s@seranking.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
- fix(stream): Fixed throwing `CommunicationException` when stream is EOF (#1548)
|
||||
- Removed automatic `conn_uid` parameter assignment (#1552)
|
||||
- fix(commands): Fixed wrong command API call on prefix processing (#1554)
|
||||
- fix `XREAD` response parsing while read null (#1563)
|
||||
|
||||
### Maintenance
|
||||
- Updated Redis 8.0 test image (#1562)
|
||||
|
||||
@@ -46,6 +46,10 @@ class XREAD extends RedisCommand
|
||||
|
||||
public function parseResponse($data)
|
||||
{
|
||||
if (!$data) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$processedData = [];
|
||||
|
||||
foreach ($data as $stream) {
|
||||
|
||||
@@ -165,6 +165,23 @@ class XREAD_Test extends PredisCommandTestCase
|
||||
$this->assertSame($expectedResponse, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @group relay-incompatible
|
||||
* @requiresRedisVersion >= 5.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function testReadNull(): void
|
||||
{
|
||||
$redis = $this->getClient();
|
||||
|
||||
$stream1Id1 = $redis->xadd('stream1', ['field1' => 'value1']);
|
||||
$redis->xdel('stream1', $stream1Id1);
|
||||
$response = $redis->xread(1, null, ['stream1'], '0-0');
|
||||
|
||||
$this->assertSame([], $response);
|
||||
}
|
||||
|
||||
public function argumentsProvider(): array
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user