Skip to content

Commit

Permalink
Merge pull request #443 from jackalope/tweak-mysql-check
Browse files Browse the repository at this point in the history
improve missing charset parameter handling
  • Loading branch information
dbu authored Apr 3, 2024
2 parents dc07257 + 120c860 commit 0f29f19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Jackalope/Transport/DoctrineDBAL/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ private function getMySQLCaseSensitiveEncoding(): string
if (isset($params['defaultTableOptions']['collate'])) {
return $this->caseSensitiveEncoding = $params['defaultTableOptions']['collate'];
}
if (!array_key_exists('charset', $params)) {
if (!array_key_exists('charset', $params) || !$params['charset']) {
throw new \InvalidArgumentException('For MySQL, the Doctrine dbal connection must have either "collate" or "charset" configured. Alternatively, you can set the encoding with '.__CLASS__.'::setCaseSensitiveEncoding().');
}
$charset = $params['charset'] ?? 'utf8';
$charset = $params['charset'];

return $this->caseSensitiveEncoding = 'binary' === $charset ? $charset : $charset.'_bin';
}
Expand Down

0 comments on commit 0f29f19

Please sign in to comment.