Skip to content

Commit

Permalink
Try to make the PHP version security requirement more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Dec 13, 2023
1 parent 7d5ad9e commit 30591e7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/System/Requirement/PhpSupportedVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class PhpSupportedVersion extends AbstractRequirement

public function __construct()
{
$this->title = __('PHP supported version');
$this->description = __('An officially supported PHP version should be used to get the benefits of security and bug fixes.');
$this->title = __('PHP maintained version');
$this->description = __('A PHP version maintained by the PHP community should be used to get the benefits of PHP security and bug fixes.');
$this->optional = true;
$this->recommended_for_security = true;
}
Expand All @@ -65,10 +65,9 @@ protected function check()
// No validation message as we cannot be sure that PHP is up-to-date.
} else {
$this->validated = false;
$this->validation_messages[] = sprintf(
__('PHP %s official support has ended. An upgrade to a more recent PHP version is recommended.'),
$php_version
);
$this->validation_messages[] = sprintf(__('PHP %s is no longer maintained by its community.'), $php_version);
$this->validation_messages[] = __('Even if GLPI still supports this PHP version, an upgrade to a more recent PHP version is recommended.');
$this->validation_messages[] = __('Indeed, this PHP version may contain unpatched security vulnerabilities.');
}
}
}
30 changes: 25 additions & 5 deletions tests/units/Glpi/System/Requirement/PhpSupportedVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,51 @@ protected function versionProvider(): iterable
yield [
'phpversion' => '7.4.0-rc1',
'validated' => false,
'messages' => ['PHP 7.4 official support has ended. An upgrade to a more recent PHP version is recommended.'],
'messages' => [
'PHP 7.4 is no longer maintained by its community.',
'Even if GLPI still supports this PHP version, an upgrade to a more recent PHP version is recommended.',
'Indeed, this PHP version may contain unpatched security vulnerabilities.',
],
];

yield [
'phpversion' => '7.4.3',
'validated' => false,
'messages' => ['PHP 7.4 official support has ended. An upgrade to a more recent PHP version is recommended.'],
'messages' => [
'PHP 7.4 is no longer maintained by its community.',
'Even if GLPI still supports this PHP version, an upgrade to a more recent PHP version is recommended.',
'Indeed, this PHP version may contain unpatched security vulnerabilities.',
],
];

yield [
'phpversion' => '7.4.99',
'validated' => false,
'messages' => ['PHP 7.4 official support has ended. An upgrade to a more recent PHP version is recommended.'],
'messages' => [
'PHP 7.4 is no longer maintained by its community.',
'Even if GLPI still supports this PHP version, an upgrade to a more recent PHP version is recommended.',
'Indeed, this PHP version may contain unpatched security vulnerabilities.',
],
];

yield [
'phpversion' => '8.0.0-rc1',
'validated' => false,
'messages' => ['PHP 8.0 official support has ended. An upgrade to a more recent PHP version is recommended.'],
'messages' => [
'PHP 8.0 is no longer maintained by its community.',
'Even if GLPI still supports this PHP version, an upgrade to a more recent PHP version is recommended.',
'Indeed, this PHP version may contain unpatched security vulnerabilities.',
],
];

yield [
'phpversion' => '8.0.15',
'validated' => false,
'messages' => ['PHP 8.0 official support has ended. An upgrade to a more recent PHP version is recommended.'],
'messages' => [
'PHP 8.0 is no longer maintained by its community.',
'Even if GLPI still supports this PHP version, an upgrade to a more recent PHP version is recommended.',
'Indeed, this PHP version may contain unpatched security vulnerabilities.',
],
];

yield [
Expand Down

0 comments on commit 30591e7

Please sign in to comment.