Ver código fonte

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

Daniele Alessandri 14 anos atrás
pai
commit
b47adffd4f
1 arquivos alterados com 1 adições e 7 exclusões
  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;