1
0
Fork 0

Make sure autoloader closures do not have a scope class set

pull/11244/head
Jordi Boggiano 2022-12-22 21:01:38 +01:00
parent 2e71896168
commit d047f38f73
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
6 changed files with 12 additions and 12 deletions

View File

@ -1021,13 +1021,13 @@ REGISTER_LOADER;
if ($useIncludeFiles) { if ($useIncludeFiles) {
$file .= <<<INCLUDE_FILES $file .= <<<INCLUDE_FILES
\$filesToLoad = \Composer\Autoload\ComposerStaticInit$suffix::\$files; \$filesToLoad = \Composer\Autoload\ComposerStaticInit$suffix::\$files;
\$requireFile = static function (\$fileIdentifier, \$file) { \$requireFile = \Closure::bind(static function (\$fileIdentifier, \$file) {
if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) { if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
\$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true; \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
require \$file; require \$file;
} }
}; }, null, null);
foreach (\$filesToLoad as \$fileIdentifier => \$file) { foreach (\$filesToLoad as \$fileIdentifier => \$file) {
(\$requireFile)(\$fileIdentifier, \$file); (\$requireFile)(\$fileIdentifier, \$file);
} }

View File

@ -574,8 +574,8 @@ class ClassLoader
* @param string $file * @param string $file
* @return void * @return void
*/ */
self::$includeFile = static function($file) { self::$includeFile = \Closure::bind(static function($file) {
include $file; include $file;
}; }, null, null);
} }
} }

View File

@ -32,13 +32,13 @@ class ComposerAutoloaderInitFilesAutoloadOrder
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::$files;
$requireFile = static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file; require $file;
} }
}; }, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) { foreach ($filesToLoad as $fileIdentifier => $file) {
($requireFile)($fileIdentifier, $file); ($requireFile)($fileIdentifier, $file);
} }

View File

@ -32,13 +32,13 @@ class ComposerAutoloaderInitFilesAutoload
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitFilesAutoload::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInitFilesAutoload::$files;
$requireFile = static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file; require $file;
} }
}; }, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) { foreach ($filesToLoad as $fileIdentifier => $file) {
($requireFile)($fileIdentifier, $file); ($requireFile)($fileIdentifier, $file);
} }

View File

@ -36,13 +36,13 @@ class ComposerAutoloaderInitFilesAutoload
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitFilesAutoload::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInitFilesAutoload::$files;
$requireFile = static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file; require $file;
} }
}; }, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) { foreach ($filesToLoad as $fileIdentifier => $file) {
($requireFile)($fileIdentifier, $file); ($requireFile)($fileIdentifier, $file);
} }

View File

@ -34,13 +34,13 @@ class ComposerAutoloaderInitTargetDir
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitTargetDir::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInitTargetDir::$files;
$requireFile = static function ($fileIdentifier, $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file; require $file;
} }
}; }, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) { foreach ($filesToLoad as $fileIdentifier => $file) {
($requireFile)($fileIdentifier, $file); ($requireFile)($fileIdentifier, $file);
} }