@@ -40,7 +40,7 @@ private function __construct(Redis $redis)
40
40
{
41
41
if (!static ::supports ($ redis )) {
42
42
throw new RuntimeException ($ this ->getMissingMessage ('phpredis ' , true , [
43
- Redis::class => ['rawCommand ' , 'multi ' , 'exec ' ],
43
+ Redis::class => ['rawCommand ' , 'multi ' , 'exec ' , ' getOption ' , ' setOption ' ],
44
44
]));
45
45
}
46
46
$ this ->redis = $ redis ;
@@ -49,13 +49,19 @@ private function __construct(Redis $redis)
49
49
public function execute (Command $ command )
50
50
{
51
51
$ arguments = $ command ->getArguments ();
52
+
53
+ $ originalValue = $ this ->redis ->getOption (Redis::OPT_REPLY_LITERAL ) ?? false ;
54
+ $ this ->redis ->setOption (Redis::OPT_REPLY_LITERAL , true );
55
+
52
56
if (0 === count ($ arguments )) {
53
57
/** @psalm-suppress TooFewArguments */
54
58
$ rawResponse = $ this ->redis ->rawCommand ($ command ->getId ());
55
59
} else {
56
60
$ rawResponse = $ this ->redis ->rawCommand ($ command ->getId (), ...$ arguments );
57
61
}
58
62
63
+ $ this ->redis ->setOption (Redis::OPT_REPLY_LITERAL , $ originalValue );
64
+
59
65
return $ command ->parseResponse ($ rawResponse );
60
66
}
61
67
@@ -64,6 +70,8 @@ public static function supports($redis): bool
64
70
return $ redis instanceof Redis
65
71
&& method_exists ($ redis , 'rawCommand ' )
66
72
&& method_exists ($ redis , 'multi ' )
73
+ && method_exists ($ redis , 'setOption ' )
74
+ && method_exists ($ redis , 'getOption ' )
67
75
&& method_exists ($ redis , 'exec ' );
68
76
}
69
77
0 commit comments