1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 06:06:40 +02:00

Fix race condition in rotating file handler, fixes #709

This commit is contained in:
Jordi Boggiano
2016-03-01 15:44:46 +00:00
parent 6079ae8bfb
commit 973d3ca7ae

View File

@@ -115,7 +115,11 @@ class RotatingFileHandler extends StreamHandler
foreach (array_slice($logFiles, $this->maxFiles) as $file) {
if (is_writable($file)) {
// suppress errors here as unlink() might fail if two processes
// are cleaning up/rotating at the same time
set_error_handler(function ($errno, $errstr, $errfile, $errline) {});
unlink($file);
restore_error_handler();
}
}