mirror of
https://github.com/predis/predis.git
synced 2026-09-14 20:37:29 +00:00
Fix response parsing with scripted commands after -NOSCRIPT.
This commit fixes issue #94.
This commit is contained in:
@@ -4,6 +4,10 @@ v0.8.1 (201x-xx-xx)
|
||||
caused PHP errors when Redis did not return `+QUEUED` replies to commands
|
||||
when inside a MULTI / EXEC context.
|
||||
|
||||
- __FIX__: the `parseResponse()` method implemented for a scripted command was
|
||||
ignored when retrying to execute a Lua script by falling back to `EVAL` after
|
||||
a `-NOSCRIPT` error (ISSUE #94).
|
||||
|
||||
|
||||
v0.8.0 (2012-10-23)
|
||||
===============================================================================
|
||||
|
||||
@@ -267,7 +267,13 @@ class Client implements ClientInterface
|
||||
$eval = $this->createCommand('eval');
|
||||
$eval->setRawArguments($command->getEvalArguments());
|
||||
|
||||
return $this->executeCommand($eval);
|
||||
$response = $this->executeCommand($eval);
|
||||
|
||||
if (false === $response instanceof ResponseObjectInterface) {
|
||||
$response = $command->parseResponse($response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
if ($this->options->exceptions === true) {
|
||||
|
||||
@@ -656,10 +656,14 @@ class ClientTest extends StandardTestCase
|
||||
*/
|
||||
public function testClientResendScriptedCommandUsingEvalOnNoScriptErrors()
|
||||
{
|
||||
$command = $this->getMockForAbstractClass('Predis\Command\ScriptedCommand');
|
||||
$command = $this->getMockForAbstractClass('Predis\Command\ScriptedCommand', array(), '', true, true, true, array('parseResponse'));
|
||||
$command->expects($this->once())
|
||||
->method('getScript')
|
||||
->will($this->returnValue('return redis.call(\'exists\', KEYS[1])'));
|
||||
$command->expects($this->once())
|
||||
->method('parseResponse')
|
||||
->with('OK')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
|
||||
$connection->expects($this->at(0))
|
||||
@@ -669,7 +673,7 @@ class ClientTest extends StandardTestCase
|
||||
$connection->expects($this->at(1))
|
||||
->method('executeCommand')
|
||||
->with($this->isInstanceOf('Predis\Command\ServerEval'))
|
||||
->will($this->returnValue(true));
|
||||
->will($this->returnValue('OK'));
|
||||
|
||||
$client = new Client($connection);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user