Browse Source

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

Daniele Alessandri 14 years ago
parent
commit
40dfabb139
1 changed files with 1 additions and 7 deletions
  1. 1 7
      lib/Predis.php

+ 1 - 7
lib/Predis.php

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