Skip to content

Commit

Permalink
fix: check if defined WRITEPATH exists (#9317)
Browse files Browse the repository at this point in the history
* fix: check if defined WRITEPATH exists

* cs fix

* Update system/Boot.php

Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>

* cs fix

---------

Co-authored-by: Pooya Parsa <pooya_parsa_dadashi@yahoo.com>
  • Loading branch information
michalsn and datamweb authored Dec 12, 2024
1 parent e9bb603 commit 9bc61b3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion system/Boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9bc61b3

Please sign in to comment.