diff --git a/src/helpers/App.php b/src/helpers/App.php index bb9bca873a9..2b511afa227 100644 --- a/src/helpers/App.php +++ b/src/helpers/App.php @@ -1031,6 +1031,11 @@ public static function dbConfig(?DbConfig $dbConfig = null): array ]; } + $dbConfigAttributes = []; + if ((new ReflectionClass('\PDO'))->hasConstant('MYSQL_ATTR_MULTI_STATEMENTS')) { + $dbConfigAttributes[PDO::MYSQL_ATTR_MULTI_STATEMENTS] = false; + } + $config = [ 'class' => Connection::class, 'driverName' => $driver, @@ -1048,7 +1053,7 @@ public static function dbConfig(?DbConfig $dbConfig = null): array $driver => Command::class, ], 'attributes' => [ - PDO::MYSQL_ATTR_MULTI_STATEMENTS => false, + ...$dbConfigAttributes, ...$dbConfig->attributes, ], 'enableSchemaCache' => !static::devMode(),