From d3dcc7631786a9cca651eb4931dbc638f1b1a4b6 Mon Sep 17 00:00:00 2001 From: Colin Mollenhour Date: Tue, 2 May 2023 16:33:56 -0400 Subject: [PATCH] Fix autoloader patch to work with composer-installed setup. (#3226) --- 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 */