Skip to content

Commit

Permalink
PDO: charset über DSN setzen (#5793)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Sep 1, 2023
1 parent fd14fa8 commit c61ea0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion redaxo/src/core/lib/sql/sql.php
Expand Up @@ -134,7 +134,7 @@ protected function selectDB($db)
self::$pdo[$db] = $conn;

// ggf. Strict Mode abschalten
self::factory($db)->setQuery('SET SESSION SQL_MODE="", NAMES utf8mb4');
self::factory($db)->setQuery('SET SESSION SQL_MODE=""');
}
} catch (PDOException $e) {
if ('cli' === PHP_SAPI) {
Expand Down Expand Up @@ -189,6 +189,7 @@ protected static function createConnection(
$dsn .= ';port=' . $port;
}
$dsn .= ';dbname=' . $database;
$dsn .= ';charset=utf8mb4';

// array_merge() doesnt work because it looses integer keys
$options += [
Expand Down

0 comments on commit c61ea0d

Please sign in to comment.