Просмотр исходного кода

Check file was opened successfully before trying to read/write

Fixes #1286
Carl Vuorinen 7 лет назад
Родитель
Сommit
b351406bb3
1 измененных файлов с 5 добавлено и 0 удалено
  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 = [];