소스 검색

Fix wrong serialization for commands that do not have arguments.

Daniele Alessandri 13 년 전
부모
커밋
0de4af07dd
1개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 4
      lib/Predis/Network/WebdisConnection.php

+ 9 - 4
lib/Predis/Network/WebdisConnection.php

@@ -129,14 +129,19 @@ class WebdisConnection implements IConnectionSingle {
     }
 
     public function executeCommand(ICommand $command) {
-        $commandId = $this->getCommandId($command);
-        $arguments = implode('/', array_map('urlencode', $command->getArguments()));
-
         $request = new HttpRequest($this->_webdisUrl, HttpRequest::METH_POST);
         if ($options = $this->getHttpOptions()) {
             $request->setOptions($options);
         }
-        $request->setBody("$commandId/$arguments.raw");
+
+        $commandId = $this->getCommandId($command);
+        if ($arguments = $command->getArguments()) {
+            $arguments = implode('/', array_map('urlencode', $arguments));
+            $request->setBody("$commandId/$arguments.raw");
+        }
+        else {
+            $request->setBody("$commandId.raw");
+        }
 
         $response = $request->send();
         phpiredis_reader_feed($this->_reader, $response->getBody());