From 30591e75a359be78b02f2c46d58ed45e65ebe3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Wed, 13 Dec 2023 15:08:32 +0100 Subject: [PATCH] Try to make the PHP version security requirement more clear --- .../Requirement/PhpSupportedVersion.php | 11 ++++--- .../Requirement/PhpSupportedVersion.php | 30 +++++++++++++++---- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/System/Requirement/PhpSupportedVersion.php b/src/System/Requirement/PhpSupportedVersion.php index e4c4c1fca6f..6bdae1e2ee4 100644 --- a/src/System/Requirement/PhpSupportedVersion.php +++ b/src/System/Requirement/PhpSupportedVersion.php @@ -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; } @@ -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.'); } } } diff --git a/tests/units/Glpi/System/Requirement/PhpSupportedVersion.php b/tests/units/Glpi/System/Requirement/PhpSupportedVersion.php index b011aad4d66..feca7ed9349 100644 --- a/tests/units/Glpi/System/Requirement/PhpSupportedVersion.php +++ b/tests/units/Glpi/System/Requirement/PhpSupportedVersion.php @@ -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 [