Disable full platform-check for extensions by default, now set to php-only, refs #9412

main
Jordi Boggiano 4 years ago
parent fc0d724938
commit 6c31744c04
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -312,8 +312,8 @@
"description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
},
"platform-check": {
"type": "boolean",
"description": "Defaults to true. If set to false, Composer will not create and require a platform_check.php file as part of the autoloader bootstrap."
"type": ["boolean", "string"],
"description": "Defaults to \"php-only\" which checks only the PHP version. Setting to true will also check the presence of required PHP extensions. If set to false, Composer will not create and require a platform_check.php file as part of the autoloader bootstrap."
}
}
},

@ -350,7 +350,7 @@ EOF;
$checkPlatform = $config->get('platform-check') && $this->ignorePlatformReqs !== true;
$platformCheckContent = null;
if ($checkPlatform) {
$platformCheckContent = $this->getPlatformCheck($packageMap, $this->ignorePlatformReqs ?: array());
$platformCheckContent = $this->getPlatformCheck($packageMap, $this->ignorePlatformReqs ?: array(), $config->get('platform-check'));
if (null === $platformCheckContent) {
$checkPlatform = false;
}
@ -609,7 +609,7 @@ EOF;
return $baseDir . (($path !== false) ? var_export($path, true) : "");
}
protected function getPlatformCheck($packageMap, array $ignorePlatformReqs)
protected function getPlatformCheck($packageMap, array $ignorePlatformReqs, $checkPlatform)
{
$lowestPhpVersion = Bound::zero();
$requiredExtensions = array();
@ -637,7 +637,7 @@ EOF;
}
}
if (preg_match('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
if ($checkPlatform === true && preg_match('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
// skip extension checks if they have a valid provider/replacer
if (isset($extensionProviders[$match[1]])) {
foreach ($extensionProviders[$match[1]] as $provided) {

@ -428,7 +428,18 @@ EOT
'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
'lock' => array($booleanValidator, $booleanNormalizer),
'platform-check' => array($booleanValidator, $booleanNormalizer),
'platform-check' => array(
function ($val) {
return in_array($val, array('php-only', 'true', 'false', '1', '0'), true);
},
function ($val) {
if ('php-only' === $val) {
return 'php-only';
}
return $val !== 'false' && (bool) $val;
},
),
);
$multiConfigValues = array(
'github-protocols' => array(

@ -65,7 +65,7 @@ class Config
'htaccess-protect' => true,
'use-github-api' => true,
'lock' => true,
'platform-check' => true,
'platform-check' => 'php-only',
// valid keys without defaults (auth config stuff):
// bitbucket-oauth
// github-oauth

Loading…
Cancel
Save