diff --git a/.gitignore b/.gitignore index baff153638..8196e3468d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ sites/*/settings*.php # Ignore paths that contain user-generated content. sites/*/files sites/*/private + +.idea* diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc index 5f584d0354..d918255048 100644 --- a/includes/database/mysql/database.inc +++ b/includes/database/mysql/database.inc @@ -21,7 +21,8 @@ class DatabaseConnection_mysql extends DatabaseConnection { /** * Whether we're running MySQL 8.x. Required to determine if we should quote - * table names. + * table names. Will be set in {@see setPrefix()}, which gets called by the + * (parent) constructor directly after the connection has been created. */ protected $isMySQL8; @@ -93,7 +94,6 @@ class DatabaseConnection_mysql extends DatabaseConnection { 'init_commands' => array(), ); - $this->isMySQL8 = version_compare($this->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.0', '>='); $sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO'; // NO_AUTO_CREATE_USER is deprecated in 8.0 and removed in MySQL 8.0.11, so // only add it to versions before 8 @@ -122,8 +122,9 @@ class DatabaseConnection_mysql extends DatabaseConnection { */ protected function setPrefix($prefix) { parent::setPrefix($prefix); + $this->isMySQL8 = version_compare($this->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.0', '>='); if ($this->isMySQL8) { - // MySQL 8 i more strict about the use of reserved keywords as table + // MySQL 8 is more strict about the use of reserved keywords as table // names. Therefore we surround all table names with back ticks (`). foreach ($this->prefixSearch as $i => $prefixSearch) { if (substr($prefixSearch, 0, 1) === '{') {