diff options
author | Jordi Boggiano <j.boggiano@seld.be> | 2016-03-01 15:44:46 +0000 |
---|---|---|
committer | Jordi Boggiano <j.boggiano@seld.be> | 2016-03-01 15:44:46 +0000 |
commit | 973d3ca7ae534d8f69ed8c51354c30120b38ea66 (patch) | |
tree | 1d56145d8fb013c5a9485b3e8f748928cdec6522 /src/Monolog/Handler/RotatingFileHandler.php | |
parent | 6079ae8bfb445450672f1c5a5c2ac1aafb3fedee (diff) | |
download | monolog-973d3ca7ae534d8f69ed8c51354c30120b38ea66.zip monolog-973d3ca7ae534d8f69ed8c51354c30120b38ea66.tar.gz monolog-973d3ca7ae534d8f69ed8c51354c30120b38ea66.tar.bz2 |
Fix race condition in rotating file handler, fixes #709
Diffstat (limited to 'src/Monolog/Handler/RotatingFileHandler.php')
-rw-r--r-- | src/Monolog/Handler/RotatingFileHandler.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Monolog/Handler/RotatingFileHandler.php b/src/Monolog/Handler/RotatingFileHandler.php index c6ca253..22e6c3d 100644 --- a/src/Monolog/Handler/RotatingFileHandler.php +++ b/src/Monolog/Handler/RotatingFileHandler.php @@ -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(); } } |