Parcourir la source

Check file was opened successfully before trying to read/write

Fixes #1286
Carl Vuorinen il y a 7 ans
Parent
commit
b351406bb3
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  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 = [];