Skip to content

Commit 9bc61b3

Browse files
michalsndatamweb
andauthored
fix: check if defined WRITEPATH exists (#9317)
* fix: check if defined WRITEPATH exists * cs fix * Update system/Boot.php Co-authored-by: Pooya Parsa <[email protected]> * cs fix --------- Co-authored-by: Pooya Parsa <[email protected]>
1 parent e9bb603 commit 9bc61b3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

system/Boot.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,16 @@ protected static function definePathConstants(Paths $paths): void
196196

197197
// The path to the writable directory.
198198
if (! defined('WRITEPATH')) {
199-
define('WRITEPATH', realpath(rtrim($paths->writableDirectory, '\\/ ')) . DIRECTORY_SEPARATOR);
199+
$writePath = realpath(rtrim($paths->writableDirectory, '\\/ '));
200+
201+
if ($writePath === false) {
202+
header('HTTP/1.1 503 Service Unavailable.', true, 503);
203+
echo 'The WRITEPATH is not set correctly.';
204+
205+
// EXIT_ERROR is not yet defined
206+
exit(1);
207+
}
208+
define('WRITEPATH', $writePath . DIRECTORY_SEPARATOR);
200209
}
201210

202211
// The path to the tests directory

0 commit comments

Comments
 (0)