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:
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user