Remove upper bound PHP version checks from platform-check as there is not enough value added and it risks causing issues
parent
0a0291e913
commit
21e708f2c4
|
@ -316,7 +316,13 @@ EOF;
|
||||||
$filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
|
$filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
|
||||||
$checkPlatform = $config->get('platform-check');
|
$checkPlatform = $config->get('platform-check');
|
||||||
if ($checkPlatform) {
|
if ($checkPlatform) {
|
||||||
$filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $this->getPlatformCheck($packageMap));
|
$platformCheckContent = $this->getPlatformCheck($packageMap);
|
||||||
|
if (null === $platformCheckContent) {
|
||||||
|
$checkPlatform = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($checkPlatform) {
|
||||||
|
$filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);
|
||||||
} elseif (file_exists($targetDir.'/platform_check.php')) {
|
} elseif (file_exists($targetDir.'/platform_check.php')) {
|
||||||
unlink($targetDir.'/platform_check.php');
|
unlink($targetDir.'/platform_check.php');
|
||||||
}
|
}
|
||||||
|
@ -572,7 +578,6 @@ EOF;
|
||||||
protected function getPlatformCheck($packageMap)
|
protected function getPlatformCheck($packageMap)
|
||||||
{
|
{
|
||||||
$lowestPhpVersion = Bound::zero();
|
$lowestPhpVersion = Bound::zero();
|
||||||
$highestPhpVersion = Bound::positiveInfinity();
|
|
||||||
$requiredExtensions = array();
|
$requiredExtensions = array();
|
||||||
$extensionProviders = array();
|
$extensionProviders = array();
|
||||||
|
|
||||||
|
@ -592,9 +597,6 @@ EOF;
|
||||||
if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
|
if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
|
||||||
$lowestPhpVersion = $constraint->getLowerBound();
|
$lowestPhpVersion = $constraint->getLowerBound();
|
||||||
}
|
}
|
||||||
if ($constraint->getUpperBound()->compareTo($highestPhpVersion, '<')) {
|
|
||||||
$highestPhpVersion = $constraint->getUpperBound();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
|
if (preg_match('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
|
||||||
|
@ -648,22 +650,15 @@ EOF;
|
||||||
return implode('.', $chunks);
|
return implode('.', $chunks);
|
||||||
};
|
};
|
||||||
|
|
||||||
$requiredPhp = array();
|
$requiredPhp = '';
|
||||||
$requiredPhpError = array();
|
$requiredPhpError = '';
|
||||||
if (!$lowestPhpVersion->isZero()) {
|
if (!$lowestPhpVersion->isZero()) {
|
||||||
$operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
|
$operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
|
||||||
$requiredPhp[] = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
|
$requiredPhp = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
|
||||||
$requiredPhpError[] = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
|
$requiredPhpError = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
|
||||||
}
|
|
||||||
if (!$highestPhpVersion->isPositiveInfinity()) {
|
|
||||||
$operator = $highestPhpVersion->isInclusive() ? '<=' : '<';
|
|
||||||
$requiredPhp[] = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($highestPhpVersion);
|
|
||||||
$requiredPhpError[] = '"'.$operator.' '.$formatToHumanReadable($highestPhpVersion).'"';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($requiredPhp) {
|
if ($requiredPhp) {
|
||||||
$requiredPhp = implode(' && ', $requiredPhp);
|
|
||||||
$requiredPhpError = implode(' and ', $requiredPhpError);
|
|
||||||
$requiredPhp = <<<PHP_CHECK
|
$requiredPhp = <<<PHP_CHECK
|
||||||
|
|
||||||
if (!($requiredPhp)) {
|
if (!($requiredPhp)) {
|
||||||
|
@ -671,8 +666,6 @@ if (!($requiredPhp)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PHP_CHECK;
|
PHP_CHECK;
|
||||||
} else {
|
|
||||||
$requiredPhp = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$requiredExtensions = implode('', $requiredExtensions);
|
$requiredExtensions = implode('', $requiredExtensions);
|
||||||
|
@ -688,6 +681,10 @@ if (\$missingExtensions) {
|
||||||
EXT_CHECKS;
|
EXT_CHECKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$requiredPhp && !$requiredExtensions) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return <<<PLATFORM_CHECK
|
return <<<PLATFORM_CHECK
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -1667,7 +1667,13 @@ EOF;
|
||||||
|
|
||||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||||
|
|
||||||
|
if (null === $expectedFixture) {
|
||||||
|
$this->assertFalse(file_exists($this->vendorDir . '/composer/platform_check.php'));
|
||||||
|
$this->assertNotContains("require __DIR__ . '/platform_check.php';", file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||||
|
} else {
|
||||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
$this->assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
||||||
|
$this->assertContains("require __DIR__ . '/platform_check.php';", file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function platformCheckProvider()
|
public function platformCheckProvider()
|
||||||
|
@ -1687,7 +1693,7 @@ EOF;
|
||||||
array(
|
array(
|
||||||
new Link('a', 'php', $versionParser->parseConstraints('< 8')),
|
new Link('a', 'php', $versionParser->parseConstraints('< 8')),
|
||||||
),
|
),
|
||||||
'no_php_lower_bound'
|
null
|
||||||
),
|
),
|
||||||
'No PHP upper bound' => array(
|
'No PHP upper bound' => array(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoloadOrder
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoload
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoload
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitFilesAutoload
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitIncludePath
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ComposerAutoloaderInitTargetDir
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
$issues = array();
|
$issues = array();
|
||||||
|
|
||||||
if (!(PHP_VERSION_ID >= 70200 && PHP_VERSION_ID < 80000)) {
|
if (!(PHP_VERSION_ID >= 70200)) {
|
||||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0" and "< 8.0.0". You are running ' . PHP_VERSION . '.';
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($issues) {
|
if ($issues) {
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// platform_check.php @generated by Composer
|
|
||||||
|
|
||||||
$issues = array();
|
|
||||||
|
|
||||||
if (!(PHP_VERSION_ID < 80000)) {
|
|
||||||
$issues[] = 'Your Composer dependencies require a PHP version "< 8.0.0". You are running ' . PHP_VERSION . '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($issues) {
|
|
||||||
echo 'Composer detected issues in your platform:' . "\n\n" . implode("\n", $issues);
|
|
||||||
exit(104);
|
|
||||||
}
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
$issues = array();
|
$issues = array();
|
||||||
|
|
||||||
if (!(PHP_VERSION_ID >= 70208 && PHP_VERSION_ID < 80000)) {
|
if (!(PHP_VERSION_ID >= 70208)) {
|
||||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.8" and "< 8.0.0". You are running ' . PHP_VERSION . '.';
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.8". You are running ' . PHP_VERSION . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($issues) {
|
if ($issues) {
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
$issues = array();
|
$issues = array();
|
||||||
|
|
||||||
if (!(PHP_VERSION_ID >= 70200 && PHP_VERSION_ID < 80000)) {
|
if (!(PHP_VERSION_ID >= 70200)) {
|
||||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0" and "< 8.0.0". You are running ' . PHP_VERSION . '.';
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$missingExtensions = array();
|
$missingExtensions = array();
|
||||||
|
|
Loading…
Reference in New Issue