1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 10:50:21 +02:00

Avoid memory leak in SocketHandler (substr function in the first iteration)

This commit is contained in:
Martin Hasoň
2012-08-02 13:21:20 +02:00
parent 26adcea582
commit 535cea507f

View File

@@ -257,7 +257,11 @@ class SocketHandler extends AbstractProcessingHandler
$length = strlen($data);
$sent = 0;
while ($this->isConnected() && $sent < $length) {
$chunk = $this->fwrite(substr($data, $sent));
if (0 == $sent) {
$chunk = $this->fwrite($data);
} else {
$chunk = $this->fwrite(substr($data, $sent));
}
if ($chunk === false) {
throw new \RuntimeException("Could not write to socket");
}