Commit 1305cbea authored by catch's avatar catch

Issue #3054060 by alexpott, neeravbm, tstoeckler: Deprecate...

Issue #3054060 by alexpott, neeravbm, tstoeckler: Deprecate \Drupal\system\SystemRequirements::phpVersionWithPdoDisallowMultipleStatements() as all supported versions of PHP return TRUE
parent c7b8bc52
......@@ -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', '<'))
......
......@@ -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());
}
......
......@@ -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));
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment