diff --git a/formwork/bootstrap.php b/formwork/bootstrap.php new file mode 100644 index 000000000..917a482f9 --- /dev/null +++ b/formwork/bootstrap.php @@ -0,0 +1,21 @@ +=')) { + require __DIR__ . DS . 'views' . DS . 'errors' . DS . 'phpversion.php'; + exit; +} + +// Check if Composer autoloader is available +if (file_exists($autoload = ROOT_PATH . 'vendor' . DS . 'autoload.php')) { + require $autoload; +} else { + require __DIR__ . DS . 'views' . DS . 'errors' . DS . 'install.php'; + exit; +} diff --git a/formwork/src/Errors.php b/formwork/src/Errors.php index b4374a90f..c9ecef949 100644 --- a/formwork/src/Errors.php +++ b/formwork/src/Errors.php @@ -29,7 +29,7 @@ public static function setHandlers(): void public static function displayErrorPage(int $status = 500): void { HTTPResponse::cleanOutputBuffers(); - $view = new View('error', ['status' => $status, 'message' => Header::HTTP_STATUS[$status]]); + $view = new View('errors.error', ['status' => $status, 'message' => Header::HTTP_STATUS[$status]]); $response = new Response($view->render(true), $status); $response->send(); // Don't exit, otherwise the error will not be logged diff --git a/formwork/views/error.php b/formwork/views/error.php deleted file mode 100644 index 588ce40c6..000000000 --- a/formwork/views/error.php +++ /dev/null @@ -1,76 +0,0 @@ - - -
-Formwork encountered an error while serving your request. Please check Formwork configuration or the server log for errors.
- -Formwork encountered an error while serving your request.
If you are the maintainer of this site, please check Formwork configuration or the server log for errors.
If you are the maintainer of this site, please run composer install. Composer autoloader was not found.