From 6ccc6f0383818f36abda1af553751be46ce7d78e Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 20 Jun 2025 22:00:05 +0700 Subject: [PATCH] [ticket/17529] Fix installer config.php availability checks PHPBB-17529 --- .../requirements/task/check_filesystem.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/phpBB/phpbb/install/module/requirements/task/check_filesystem.php b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php index f08b7b960d..c432e40fbc 100644 --- a/phpBB/phpbb/install/module/requirements/task/check_filesystem.php +++ b/phpBB/phpbb/install/module/requirements/task/check_filesystem.php @@ -145,32 +145,32 @@ class check_filesystem extends \phpbb\install\task_base // Try to create file if it does not exists if (!file_exists($path)) { - $fp = @fopen($path, 'w'); - @fclose($fp); - try + if (!is_resource($fp = @fopen($path, 'w'))) { - $this->filesystem->phpbb_chmod($path, - \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE - ); - $exists = true; + $exists = $writable = false; } - catch (\phpbb\filesystem\exception\filesystem_exception $e) + else { - // Do nothing + @fclose($fp); + try + { + $this->filesystem->phpbb_chmod($path, + \phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE + ); + $exists = true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + $writable = false; + } } } - - if (file_exists($path)) + else if (!$this->filesystem->is_writable($path)) { - if (!$this->filesystem->is_writable($path)) { $writable = false; } } - else - { - $exists = $writable = false; - } $this->set_test_passed(($exists && $writable) || $failable);