Browse Source

Check file was opened successfully before trying to read/write

Fixes #1286
Carl Vuorinen 7 years ago
parent
commit
b351406bb3
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/Monolog/Handler/DeduplicationHandler.php

+ 5 - 0
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 = [];