From ef0d9a9be0eb25ff45c176dd64485b8c52151da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Dufraisse?= Date: Wed, 9 Feb 2022 10:11:10 +0100 Subject: [PATCH] fix(YesWikiLoader): better catch error if file not existing (otherwise catching depends on php.ini) --- includes/YesWikiLoader.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/YesWikiLoader.php b/includes/YesWikiLoader.php index e540c303c..7f78b1366 100644 --- a/includes/YesWikiLoader.php +++ b/includes/YesWikiLoader.php @@ -13,6 +13,7 @@ namespace YesWiki\Core; use Doctrine\Common\Annotations\AnnotationRegistry; +use Exception; use Throwable; use YesWiki\Wiki; @@ -33,13 +34,12 @@ public static function getWiki(bool $test = false): Wiki if (is_null(self::$wiki)) { require_once 'includes/autoload.inc.php'; try { - $loader = require_once 'vendor/autoload.php'; - } catch (Throwable $th) { - $message = ""; if (!file_exists('vendor/autoload.php')) { - $message .= "ERROR ! : Folder `vendor/` seems not to be entirely copied ! (Maybe a YesWiki update aborted before its end !)
Could you manually copy the folder `vendor/` on your server by ftp ?
"; + throw new Exception("ERROR ! : Folder `vendor/` seems not to be entirely copied ! (Maybe a YesWiki update aborted before its end !)
Could you manually copy the folder `vendor/` on your server by ftp ?
"); } - $message .= $th->getMessage(); + $loader = require_once 'vendor/autoload.php'; + } catch (Throwable $th) { + $message = $th->getMessage(); // echo message directly because TemplateEngine not ready here echo "
$message
"; exit();