BlacklistPhp72Versions.php in Automatic Updates 7
File
ReadinessCheckers/BlacklistPhp72Versions.php
View source
<?php
use Composer\Semver\VersionParser;
class BlacklistPhp72Versions implements ReadinessCheckerInterface {
public static function run() {
$project_root = drupal_get_path('module', 'automatic_updates');
require_once $project_root . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
$messages = [];
$parser = new VersionParser();
$unsupported_constraint = static::getUnsupportedVersionConstraint();
if ($unsupported_constraint
->matches($parser
->parseConstraints(static::getPhpVersion()))) {
$messages[] = static::getMessage();
}
return $messages;
}
protected static function getPhpVersion() {
return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
}
protected static function getUnsupportedVersionConstraint() {
$parser = new VersionParser();
return $parser
->parseConstraints('>=7.2.0 <=7.2.2');
}
protected static function getMessage() {
return t('PHP 7.2.0, 7.2.1 and 7.2.2 have issues with opcache that breaks signature validation. Please upgrade to a newer version of PHP to ensure assurance and security for package signing.');
}
}