1
0
Fork 0

Allow autoload to run on 5.6 still, add early exits when running composer or autoload.php with outdated PHP versions, fixes #10714, refs #10709

pull/10718/head
Jordi Boggiano 2022-04-06 22:07:16 +02:00
parent 2ef9e14c2f
commit e0cce2bfb0
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
11 changed files with 33 additions and 7 deletions

View File

@ -5,6 +5,11 @@ if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
} }
if (PHP_VERSION_ID < 70205) {
echo 'Composer 2.3.0 dropped support for PHP <7.2.5 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
setlocale(LC_ALL, 'C'); setlocale(LC_ALL, 'C');
require __DIR__.'/../src/bootstrap.php'; require __DIR__.'/../src/bootstrap.php';

View File

@ -917,6 +917,11 @@ PLATFORM_CHECK;
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once $vendorPathToTargetDirCode; require_once $vendorPathToTargetDirCode;
return ComposerAutoloaderInit$suffix::getLoader(); return ComposerAutoloaderInit$suffix::getLoader();
@ -993,9 +998,10 @@ CLASSLOADER_INIT;
INCLUDE_PATH; INCLUDE_PATH;
} }
// keeping PHP 5.6+ compatibility for the autoloader here by using call_user_func vs getInitializer()()
$file .= <<<STATIC_INIT $file .= <<<STATIC_INIT
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader)(); call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
STATIC_INIT; STATIC_INIT;

View File

@ -2,6 +2,11 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitFilesAutoload::getLoader(); return ComposerAutoloaderInitFilesAutoload::getLoader();

View File

@ -2,6 +2,11 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitFilesAutoloadOrder::getLoader(); return ComposerAutoloaderInitFilesAutoloadOrder::getLoader();

View File

@ -27,7 +27,7 @@ class ComposerAutoloaderInitFilesAutoloadOrder
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::getInitializer($loader)(); call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::getInitializer($loader));
$loader->register(true); $loader->register(true);

View File

@ -27,7 +27,7 @@ class ComposerAutoloaderInitFilesAutoload
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader)(); call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
$loader->register(true); $loader->register(true);

View File

@ -31,7 +31,7 @@ class ComposerAutoloaderInitFilesAutoload
set_include_path(implode(PATH_SEPARATOR, $includePaths)); set_include_path(implode(PATH_SEPARATOR, $includePaths));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader)(); call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
$loader->register(true); $loader->register(true);

View File

@ -27,7 +27,7 @@ class ComposerAutoloaderInitFilesAutoload
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader)(); call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
$loader->register(true); $loader->register(true);

View File

@ -27,7 +27,7 @@ class ComposerAutoloaderInitIncludePath
spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInitIncludePath::getInitializer($loader)(); call_user_func(\Composer\Autoload\ComposerStaticInitIncludePath::getInitializer($loader));
$loader->setUseIncludePath(true); $loader->setUseIncludePath(true);
spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'autoload'), true, true); spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'autoload'), true, true);

View File

@ -27,7 +27,7 @@ class ComposerAutoloaderInitTargetDir
spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader)(); call_user_func(\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader));
spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true); spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true);

View File

@ -2,6 +2,11 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitTargetDir::getLoader(); return ComposerAutoloaderInitTargetDir::getLoader();