From b351406bb3b4fb571bbffe62e3a5cec68e8043f0 Mon Sep 17 00:00:00 2001 From: Carl Vuorinen Date: Mon, 4 Feb 2019 09:07:35 +0200 Subject: [PATCH] Check file was opened successfully before trying to read/write Fixes #1286 --- src/Monolog/Handler/DeduplicationHandler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Monolog/Handler/DeduplicationHandler.php b/src/Monolog/Handler/DeduplicationHandler.php index 0c2a3cbd..864c29ae 100644 --- a/src/Monolog/Handler/DeduplicationHandler.php +++ b/src/Monolog/Handler/DeduplicationHandler.php @@ -137,6 +137,11 @@ class DeduplicationHandler extends BufferHandler } $handle = fopen($this->deduplicationStore, 'rw+'); + + if (!$handle) { + throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore); + } + flock($handle, LOCK_EX); $validLogs = [];