From 91a3b40a99893d73bf2fb401314553d7080a86f6 Mon Sep 17 00:00:00 2001 From: Bruno Fischer Date: Mon, 16 Sep 2024 11:21:24 +0200 Subject: [PATCH] Update bootstrap.php ISSUE 1552 --- bootstrap.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bootstrap.php b/bootstrap.php index 740e3d044c..c7bca2a5ed 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -15,9 +15,19 @@ * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 */ -$vendorDirPath = realpath(__DIR__ . '/vendor'); +$vendorDirPath = realpath(__DIR__); +$normalizedPath = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $vendorDirPath); + +$toRemove = DIRECTORY_SEPARATOR . 'phpoffice' . DIRECTORY_SEPARATOR . 'phpword'; +$newPath = str_replace($toRemove, '', $normalizedPath); + +$vendorDirNewPath = rtrim($newPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + if (file_exists($vendorDirPath . '/autoload.php')) { require $vendorDirPath . '/autoload.php'; +} +elseif (file_exists($vendorDirNewPath . '/autoload.php')) { + require $vendorDirNewPath . '/autoload.php'; } else { throw new Exception( sprintf(