Skip to content

Commit

Permalink
[BUGFIX] Correctly resolve arrays in log messages
Browse files Browse the repository at this point in the history
When using an array as data for a log entry placeholder,
it must be imploded as otherwise the placeholder would
not be resolved by AbstractWriter->interpolate().

Additionally, the exception is now correctly added to the
log message string in PhpErrorLogWriter again.

Resolves: #94594
Related: #94315
Releases: master
Change-Id: I0aa79e511fd164a75e974547057477479234c25b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69978
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
o-ba authored and lolli42 committed Jul 22, 2021
1 parent 7970143 commit bcb5090
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ protected function getAuthServices(string $subType, array $loginData, array $aut
if (!empty($serviceChain)) {
$this->logger->debug('{subtype} auth services called: {chain}', [
'subtype' => $subType,
'chain' => $serviceChain,
'chain' => implode(',', $serviceChain),
]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Log/Writer/PhpErrorLogWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function writeLog(LogRecord $record)
strtoupper($record->getLevel()),
$record->getRequestId(),
$record->getComponent(),
$this->interpolate($record->getMessage(), $context),
$this->interpolate($message, $context),
$data
);
if (false === error_log($message)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function createUserAspect(bool $respectUserGroups = true): UserAspect
$this->updateOnlineTimestamp();
}

$this->logger->debug('Valid frontend usergroups: {groups}', ['groups' => $userGroups]);
$this->logger->debug('Valid frontend usergroups: {groups}', ['groups' => implode(',', $userGroups)]);
return GeneralUtility::makeInstance(UserAspect::class, $this, $userGroups);
}
/**
Expand Down

0 comments on commit bcb5090

Please sign in to comment.