diff --git a/system/Boot.php b/system/Boot.php index 8b75908ded09..4b2d20ca95b6 100644 --- a/system/Boot.php +++ b/system/Boot.php @@ -196,7 +196,16 @@ protected static function definePathConstants(Paths $paths): void // The path to the writable directory. if (! defined('WRITEPATH')) { - define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR); + $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); + } + define('WRITEPATH', $writePath . DIRECTORY_SEPARATOR); } // The path to the tests directory