瀏覽代碼

Do not perform useless read operations in the bulk reply handler.

Daniele Alessandri 14 年之前
父節點
當前提交
b47adffd4f
共有 1 個文件被更改,包括 1 次插入7 次删除
  1. 1 7
      lib/Predis.php

+ 1 - 7
lib/Predis.php

@@ -1692,13 +1692,7 @@ class ResponseBulkHandler implements IResponseHandler {
 
         $length = (int) $length;
         if ($length >= 0) {
-            $value = $length > 0 ? $connection->readBytes($length) : '';
-            if ($connection->readBytes(2) !== TextProtocol::NEWLINE) {
-                Utils::onCommunicationException(new MalformedServerResponse(
-                    $connection, 'Did not receive a new-line at the end of a bulk response'
-                ));
-            }
-            return $value;
+          return $length > 0 ? substr($connection->readBytes($length + 2), 0, -2) : '';
         }
         if ($length == -1) {
             return null;