diff --git a/core/modules/system/src/SystemRequirements.php b/core/modules/system/src/SystemRequirements.php index 225a8b819f8c67d7fae14cc642d6553663cf6b81..7a4e5dea61e22e26ce08c1bd494c34831a1493a7 100644 --- a/core/modules/system/src/SystemRequirements.php +++ b/core/modules/system/src/SystemRequirements.php @@ -2,10 +2,10 @@ namespace Drupal\system; +@trigger_error(__NAMESPACE__ . '\SystemRequirements is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. All supported PHP versions support disabling multi-statement queries in MySQL. See https://www.drupal.org/node/3054692', E_USER_DEPRECATED); + /** * Class for helper methods used for the system requirements. - * - * @todo Deprecate this class. https://www.drupal.org/node/3054060 */ class SystemRequirements { @@ -15,8 +15,15 @@ class SystemRequirements { * @param string $phpversion * * @return bool + * + * @deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. All + * supported PHP versions support disabling multi-statement queries in + * MySQL. + * + * @see https://www.drupal.org/node/3054692 */ public static function phpVersionWithPdoDisallowMultipleStatements($phpversion) { + @trigger_error(__NAMESPACE__ . '\SystemRequirements::phpVersionWithPdoDisallowMultipleStatements() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. All supported PHP versions support disabling multi-statement queries in MySQL. See https://www.drupal.org/node/3054692', E_USER_DEPRECATED); // PDO::MYSQL_ATTR_MULTI_STATEMENTS was introduced in PHP versions 5.5.21 // and 5.6.5. return (version_compare($phpversion, '5.5.21', '>=') && version_compare($phpversion, '5.6.0', '<')) diff --git a/core/modules/system/tests/src/Functional/System/StatusTest.php b/core/modules/system/tests/src/Functional/System/StatusTest.php index c902a3731f938cf235078b92cfdce060bf2a64aa..6b25e235a33274144ffcbb4d0b17a3561be190f1 100644 --- a/core/modules/system/tests/src/Functional/System/StatusTest.php +++ b/core/modules/system/tests/src/Functional/System/StatusTest.php @@ -4,7 +4,6 @@ use Drupal\Core\Url; use Drupal\Tests\BrowserTestBase; -use Drupal\system\SystemRequirements; use Symfony\Component\CssSelector\CssSelectorConverter; /** @@ -52,15 +51,6 @@ public function testStatusPage() { $phpversion = phpversion(); $this->assertText($phpversion, 'Php version is shown on the page.'); - // Checks if the suggestion to update to php 5.5.21 or 5.6.5 for disabling - // multiple statements is present when necessary. - if (\Drupal::database()->driver() === 'mysql' && !SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($phpversion)) { - $this->assertText(t('PHP (multiple statement disabling)')); - } - else { - $this->assertNoText(t('PHP (multiple statement disabling)')); - } - if (function_exists('phpinfo')) { $this->assertLinkByHref(Url::fromRoute('system.php')->toString()); } diff --git a/core/modules/system/tests/src/Unit/SystemRequirementsTest.php b/core/modules/system/tests/src/Unit/SystemRequirementsTest.php index 4a7f9c70805013bb8b60dea8c374fe5fc114c4f3..3fbcfedec7c66ae5c08ea69ed32073e6840175e3 100644 --- a/core/modules/system/tests/src/Unit/SystemRequirementsTest.php +++ b/core/modules/system/tests/src/Unit/SystemRequirementsTest.php @@ -8,12 +8,14 @@ /** * @coversDefaultClass \Drupal\system\SystemRequirements * @group system + * @group legacy */ class SystemRequirementsTest extends UnitTestCase { /** * @covers ::phpVersionWithPdoDisallowMultipleStatements * @dataProvider providerTestPhpVersionWithPdoDisallowMultipleStatements + * @expectedDeprecation Drupal\system\SystemRequirements::phpVersionWithPdoDisallowMultipleStatements() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. All supported PHP versions support disabling multi-statement queries in MySQL. See https://www.drupal.org/node/3054692 */ public function testPhpVersionWithPdoDisallowMultipleStatements($version, $expected) { $this->assertEquals($expected, SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($version)); diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php index 47e11dadf9f42ffa7d97b88fcb104ab7f4a343e6..6d0a6e3f78e2bbfb2805b9a81cdf60400fd9f9c4 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php @@ -117,12 +117,12 @@ public function testConnectionOptions() { } /** - * Ensure that you cannot execute multiple statements on phpversion() > 5.5.21 or > 5.6.5. + * Ensure that you cannot execute multiple statements on MySQL. */ public function testMultipleStatementsForNewPhp() { // This just tests mysql, as other PDO integrations don't allow disabling // multiple statements. - if (Database::getConnection()->databaseType() !== 'mysql' || !defined('\PDO::MYSQL_ATTR_MULTI_STATEMENTS')) { + if (Database::getConnection()->databaseType() !== 'mysql') { return; }