Prevent failures serializing commands with "holes" in arguments array.

This could be triggered when passing an array with "holes" to variadic commands.
Connection classes based on the protocol serialized exposed by phpiredis were
not affected by this bug.

Fixes #316.
This commit is contained in:
Daniele Alessandri
2016-05-08 18:35:06 +02:00
parent 57a7d5d3e6
commit a0487ec5f4
5 changed files with 43 additions and 4 deletions
@@ -241,6 +241,19 @@ abstract class PredisConnectionTestCase extends PredisTestCase
$this->assertEquals('PONG', $connection->executeCommand($cmdPing));
}
/**
* @group disconnected
*/
public function testExecutesCommandWithHolesInArguments()
{
$profile = $this->getCurrentProfile();
$cmdDel = $profile->createCommand('mget', array(0 => 'key:0', 2 => 'key:2'));
$connection = $this->createConnection();
$this->assertSame(array(null, null), $connection->executeCommand($cmdDel));
}
/**
* @group connected
*/