From e14050491ae8db5814ef9e7fceeabc5f75a8b8a6 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 6 Jan 2023 01:10:57 +0100 Subject: [PATCH] Config fixing - unlock/close the `node.config.php` in every circumstances --- src/Core/Config/Util/ConfigFileManager.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Core/Config/Util/ConfigFileManager.php b/src/Core/Config/Util/ConfigFileManager.php index 569bcdb97..e0b82e656 100644 --- a/src/Core/Config/Util/ConfigFileManager.php +++ b/src/Core/Config/Util/ConfigFileManager.php @@ -182,16 +182,18 @@ class ConfigFileManager $content = '' . $content); if (is_array($dataArray)) { @@ -250,12 +252,12 @@ class ConfigFileManager clearstatcache(true, $filename); if (!ftruncate($configStream, 0) || !fwrite($configStream, $encodedData) || - !fflush($configStream) || - !flock($configStream, LOCK_UN)) { + !fflush($configStream)) { throw new ConfigFileException(sprintf('Cannot modify locked file %s', $filename)); } } } finally { + flock($configStream, LOCK_UN); fclose($configStream); } }