fix XREAD parse null response (#1563)

Co-authored-by: aleksanders <alexander.s@seranking.com>
This commit is contained in:
alschastny
2025-06-17 10:39:31 +03:00
committed by GitHub
parent 9992595711
commit ec375afa4a
3 changed files with 22 additions and 0 deletions
+1
View File
@@ -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)
+4
View File
@@ -46,6 +46,10 @@ class XREAD extends RedisCommand
public function parseResponse($data)
{
if (!$data) {
return [];
}
$processedData = [];
foreach ($data as $stream) {
+17
View File
@@ -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 [