mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 04:37:38 +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);
|
$length = strlen($data);
|
||||||
$sent = 0;
|
$sent = 0;
|
||||||
while ($this->isConnected() && $sent < $length) {
|
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) {
|
if ($chunk === false) {
|
||||||
throw new \RuntimeException("Could not write to socket");
|
throw new \RuntimeException("Could not write to socket");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user