From aeff8b80cb9e65b3a0e82c3b118cc378f85105a0 Mon Sep 17 00:00:00 2001 From: Colin Mollenhour Date: Mon, 1 May 2023 19:32:24 -0400 Subject: [PATCH] Fix autoloader patch to work with composer-installed setup. --- app/Mage.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Mage.php b/app/Mage.php index 8a019d43a7a..7e3e58afe5c 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -43,9 +43,14 @@ Varien_Autoload::register(); /** AUTOLOADER PATCH **/ -if (file_exists($autoloaderPath = (getenv('COMPOSER_VENDOR_PATH') ?: BP . DS . 'vendor') . DS . 'autoload.php')) { - require $autoloaderPath; +$autoloaderPath = getenv('COMPOSER_VENDOR_PATH'); +if (!$autoloaderPath) { + $autoloaderPath = dirname(BP) . DS . 'vendor'; + if (!is_dir($autoloaderPath)) { + $autoloaderPath = BP . DS . 'vendor'; + } } +require $autoloaderPath . DS . 'autoload.php'; /** AUTOLOADER PATCH **/ /* Support additional includes, such as composer's vendor/autoload.php files */