From: Philipp Date: Sun, 8 Jan 2023 01:04:25 +0000 (+0100) Subject: Fix loading empty node.config.php X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0429a4e4296ef0a21804c546b7a3cf483e9c0a46;p=friendica.git Fix loading empty node.config.php --- diff --git a/src/Core/Config/Util/ConfigFileManager.php b/src/Core/Config/Util/ConfigFileManager.php index f3627cf477..fff240bb30 100644 --- a/src/Core/Config/Util/ConfigFileManager.php +++ b/src/Core/Config/Util/ConfigFileManager.php @@ -177,7 +177,7 @@ class ConfigFileManager { $filename = $this->configDir . '/' . self::CONFIG_DATA_FILE; - if (file_exists($filename)) { + if (file_exists($filename) && (filesize($filename) > 0)) { // The fallback empty return content $content = 'get('system', 'default_timezone')); } + + /** + * Test for empty node.config.php + */ + public function testEmptyFile() + { + $this->delConfigFile('node.config.php'); + + vfsStream::newFile('node.config.php') + ->at($this->root->getChild('config')) + ->setContent(''); + + $configFileManager = (new Config())->createConfigFileManager($this->root->url()); + $configCache = new Cache(); + + $configFileManager->setupCache($configCache); + + self::assertEquals(1,1); + } }