@@ -40,7 +40,7 @@ private function __construct(Redis $redis)
4040 {
4141 if (!static ::supports ($ redis )) {
4242 throw new RuntimeException ($ this ->getMissingMessage ('phpredis ' , true , [
43- Redis::class => ['rawCommand ' , 'multi ' , 'exec ' ],
43+ Redis::class => ['rawCommand ' , 'multi ' , 'exec ' , ' getOption ' , ' setOption ' ],
4444 ]));
4545 }
4646 $ this ->redis = $ redis ;
@@ -49,13 +49,19 @@ private function __construct(Redis $redis)
4949 public function execute (Command $ command )
5050 {
5151 $ arguments = $ command ->getArguments ();
52+
53+ $ originalValue = $ this ->redis ->getOption (Redis::OPT_REPLY_LITERAL ) ?? false ;
54+ $ this ->redis ->setOption (Redis::OPT_REPLY_LITERAL , true );
55+
5256 if (0 === count ($ arguments )) {
5357 /** @psalm-suppress TooFewArguments */
5458 $ rawResponse = $ this ->redis ->rawCommand ($ command ->getId ());
5559 } else {
5660 $ rawResponse = $ this ->redis ->rawCommand ($ command ->getId (), ...$ arguments );
5761 }
5862
63+ $ this ->redis ->setOption (Redis::OPT_REPLY_LITERAL , $ originalValue );
64+
5965 return $ command ->parseResponse ($ rawResponse );
6066 }
6167
@@ -64,6 +70,8 @@ public static function supports($redis): bool
6470 return $ redis instanceof Redis
6571 && method_exists ($ redis , 'rawCommand ' )
6672 && method_exists ($ redis , 'multi ' )
73+ && method_exists ($ redis , 'setOption ' )
74+ && method_exists ($ redis , 'getOption ' )
6775 && method_exists ($ redis , 'exec ' );
6876 }
6977
0 commit comments