Explorar o código

Fix a bug in Predis\Network\StreamConnection::writeBytes().

When PHP's fwrite() ends up writing only a part of $buffer over the network,
this method attempts to automatically write the rest of $buffer. Due to this
bug, the data being already sent to the server was not discarded from $buffer.
Usually fwrite() writes the whole $buffer in one go, but anyway this bug would
not have passed unnoticed since it results in malformed requests and Redis
would have surely returned a -ERR reply.
Daniele Alessandri %!s(int64=14) %!d(string=hai) anos
pai
achega
0195a7488a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      lib/Predis/Network/StreamConnection.php

+ 1 - 1
lib/Predis/Network/StreamConnection.php

@@ -103,7 +103,7 @@ class StreamConnection extends ConnectionBase {
             if ($written === false || $written === 0) {
                 $this->onConnectionError('Error while writing bytes to the server');
             }
-            $value = substr($buffer, $written);
+            $buffer = substr($buffer, $written);
         }
     }