From 7991d8edc31053dc57b7489c4677a780d2567a95 Mon Sep 17 00:00:00 2001 From: David Snopek Date: Thu, 20 Jul 2017 12:31:04 -0500 Subject: [PATCH] Only load autoload.php from local vendor directory if it exists --- CRM/Core/ClassLoader.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CRM/Core/ClassLoader.php b/CRM/Core/ClassLoader.php index 737982c65d..17aa8eb3e4 100644 --- a/CRM/Core/ClassLoader.php +++ b/CRM/Core/ClassLoader.php @@ -103,9 +103,11 @@ class CRM_Core_ClassLoader { return; } $civicrm_base_path = dirname(dirname(__DIR__)); + $composer_autoload = "$civicrm_base_path/vendor/autoload.php"; - // @todo: need some way to check if we should register vendor or not - //require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php'; + if (file_exists($composer_autoload)) { + require_once $composer_autoload; + } // we do this to prevent a autoloader errors with joomla / 3rd party packages // use absolute path since we dont know the content of include_path as yet @@ -124,8 +126,10 @@ class CRM_Core_ClassLoader { ); $include_paths = implode(PATH_SEPARATOR, $include_paths); set_include_path($include_paths . PATH_SEPARATOR . get_include_path()); - // @todo: need some way to check if we should register vendor or not - //require_once "$civicrm_base_path/vendor/autoload.php"; + // @todo Why do we need to load this again? + if (file_exists($composer_autoload)) { + require_once $composer_autoload; + } } /** -- 2.25.1