From 9d28744f84d85ff582ed9409090e5dd23360a4b1 Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 11 Dec 2024 19:16:34 +0100 Subject: [PATCH 1/4] fix: check if defined WRITEPATH exists --- system/Boot.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/Boot.php b/system/Boot.php index 8b75908ded09..c38b6391f5e1 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -196,7 +196,13 @@ protected static function definePathConstants(Paths $paths): void // The path to the writable directory. if (! defined('WRITEPATH')) { - define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); + if (($writePath = realpath(rtrim($paths->writableDirectory, '\\/ '))) === false) { + header('HTTP/1.1 503 Service Unavailable.', true, 503); + echo 'The WRITEPATH is not set correctly.'; + // EXIT_ERROR is not yet defined + exit(1); + } + define('WRITEPATH', $writePath . DIRECTORY_SEPARATOR); } // The path to the tests directory From 88a15129850cda1250e6d611dcdfdac746dd2978 Mon Sep 17 00:00:00 2001 From: michalsn Date: Wed, 11 Dec 2024 19:20:41 +0100 Subject: [PATCH 2/4] cs fix --- system/Boot.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/Boot.php b/system/Boot.php index c38b6391f5e1..fc1d7c74a462 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -199,6 +199,7 @@ protected static function definePathConstants(Paths $paths): void if (($writePath = realpath(rtrim($paths->writableDirectory, '\\/ '))) === false) { header('HTTP/1.1 503 Service Unavailable.', true, 503); echo 'The WRITEPATH is not set correctly.'; + // EXIT_ERROR is not yet defined exit(1); } From 959b4e472ea5ef8533dd3a448643aa4444b791eb Mon Sep 17 00:00:00 2001 From: Michal Sniatala Date: Thu, 12 Dec 2024 08:03:47 +0100 Subject: [PATCH 3/4] Update system/Boot.php Co-authored-by: Pooya Parsa --- system/Boot.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/Boot.php b/system/Boot.php index fc1d7c74a462..da4ea864e105 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -196,10 +196,12 @@ protected static function definePathConstants(Paths $paths): void // The path to the writable directory. if (! defined('WRITEPATH')) { - if (($writePath = realpath(rtrim($paths->writableDirectory, '\\/ '))) === false) { + + $writePath = realpath(rtrim($paths->writableDirectory, '\\/ ')); + + if ($writePath === false) { header('HTTP/1.1 503 Service Unavailable.', true, 503); echo 'The WRITEPATH is not set correctly.'; - // EXIT_ERROR is not yet defined exit(1); } From a7d0699a68bb9ffaa30f2a67609cd13093c838e8 Mon Sep 17 00:00:00 2001 From: michalsn Date: Thu, 12 Dec 2024 08:04:22 +0100 Subject: [PATCH 4/4] cs fix --- system/Boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Boot.php b/system/Boot.php index da4ea864e105..4b2d20ca95b6 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -196,12 +196,12 @@ protected static function definePathConstants(Paths $paths): void // The path to the writable directory. if (! defined('WRITEPATH')) { - $writePath = realpath(rtrim($paths->writableDirectory, '\\/ ')); - + if ($writePath === false) { header('HTTP/1.1 503 Service Unavailable.', true, 503); echo 'The WRITEPATH is not set correctly.'; + // EXIT_ERROR is not yet defined exit(1); }