Merge pull request '[various] Update Composer dependencies ahead of release' (#1487...
[friendica-addons.git/.git] / monolog / vendor / monolog / monolog / src / Monolog / Handler / StreamHandler.php
index 6518351..82c048e 100644 (file)
@@ -135,11 +135,14 @@ class StreamHandler extends AbstractProcessingHandler
             $this->createDir($url);
             $this->errorMessage = null;
             set_error_handler([$this, 'customErrorHandler']);
-            $stream = fopen($url, 'a');
-            if ($this->filePermission !== null) {
-                @chmod($url, $this->filePermission);
+            try {
+                $stream = fopen($url, 'a');
+                if ($this->filePermission !== null) {
+                    @chmod($url, $this->filePermission);
+                }
+            } finally {
+                restore_error_handler();
             }
-            restore_error_handler();
             if (!is_resource($stream)) {
                 $this->stream = null;