Skip to content

Commit

Permalink
fix: correct check for set SQL_Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tinect committed Aug 15, 2024
1 parent 10417f0 commit 0070e58
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void
'sql_group_concat_max_len',
'MySQL value group_concat_max_len',
(string) $groupConcatMaxLen,
'Atleast ' . self::MYSQL_GROUP_CONCAT_MAX_LEN,
'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN,
self::DOCUMENTATION_URL,
),
);
Expand All @@ -46,15 +46,14 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void

private function checkSqlMode(HealthCollection $collection): void
{
/** @var string|false $sqlMode */
$sqlMode = $this->connection->fetchOne('SELECT @@sql_mode');
if (!$sqlMode || !str_contains($sqlMode, self::MYSQL_SQL_MODE_PART)) {
if (\is_string($sqlMode) && \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART)) {
$collection->add(
SettingsResult::error(
'sql_mode',
'MySQL value sql_mode',
(string) $sqlMode,
'Contains ' . self::MYSQL_SQL_MODE_PART,
$sqlMode,
'No ' . self::MYSQL_SQL_MODE_PART,
self::DOCUMENTATION_URL,
),
);
Expand Down

0 comments on commit 0070e58

Please sign in to comment.