Explorar o código

Check file was opened successfully before trying to read/write

Fixes #1286
Carl Vuorinen %!s(int64=7) %!d(string=hai) anos
pai
achega
b351406bb3
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  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+');
         $handle = fopen($this->deduplicationStore, 'rw+');
+
+        if (!$handle) {
+            throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore);
+        }
+
         flock($handle, LOCK_EX);
         flock($handle, LOCK_EX);
         $validLogs = [];
         $validLogs = [];