From 1305cbeaca1aa35631f503b9fd93dbbc4602a3c6 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 10 Jun 2019 14:51:07 +0100
Subject: [PATCH] Issue #3054060 by alexpott, neeravbm, tstoeckler: Deprecate
 \Drupal\system\SystemRequirements::phpVersionWithPdoDisallowMultipleStatements()
 as all supported versions of PHP return TRUE

---
 core/modules/system/src/SystemRequirements.php        | 11 +++++++++--
 .../system/tests/src/Functional/System/StatusTest.php | 10 ----------
 .../system/tests/src/Unit/SystemRequirementsTest.php  |  2 ++
 .../KernelTests/Core/Database/ConnectionTest.php      |  4 ++--
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/core/modules/system/src/SystemRequirements.php b/core/modules/system/src/SystemRequirements.php
index 225a8b819f8c..7a4e5dea61e2 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 c902a3731f93..6b25e235a332 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 4a7f9c708050..3fbcfedec7c6 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 47e11dadf9f4..6d0a6e3f78e2 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;
     }
 
-- 
GitLab