From 8553c6d9784c9ab4ef22240725c1344728a4b279 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 10 Nov 2021 21:37:33 +0100 Subject: [PATCH] Add loading of files autoload section for plugins and Composer runtime autoloaders (#10065) --- src/Composer/Autoload/AutoloadGenerator.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 482dc0c21..1fba298ed 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -611,6 +611,12 @@ EOF; } } + if (isset($autoloads['files'])) { + foreach ($autoloads['files'] as $fileIdentifier => $file) { + composerRequire($fileIdentifier, $file); + } + } + return $loader; } @@ -1393,3 +1399,12 @@ INITIALIZER; return $sortedPackageMap; } } + +function composerRequire($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +}