Commit 84a5e867 authored by Nikita Hovratov's avatar Nikita Hovratov Committed by Benni Mack
Browse files

[TASK] Fix undefined array key error in DataHandler logs

The variable $log_data does not always have 5 entries. Use the array
spread operator to provide all available entries.

Resolves: #95066
Releases: master
Change-Id: Iead57b5d6c6bd43cfe8c9f3abaf5bfc1cd8ecd9c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70858

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 3ed60c1c
......@@ -8846,11 +8846,9 @@ class DataHandler implements LoggerAwareInterface
->execute();
while ($row = $result->fetchAssociative()) {
$log_data = unserialize($row['log_data']);
$msg = $row['error'] . ': ' . sprintf($row['details'], $log_data[0] ?? '', $log_data[1] ?? '', $log_data[2] ?? '', $log_data[3] ?? '', $log_data[4] ?? '');
/** @var FlashMessage $flashMessage */
$log_data = unserialize($row['log_data']) ?: [];
$msg = $row['error'] . ': ' . sprintf($row['details'], ...$log_data);
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $msg, '', $row['error'] === SystemLogErrorClassification::WARNING ? FlashMessage::WARNING : FlashMessage::ERROR, true);
/** @var FlashMessageService $flashMessageService */
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$defaultFlashMessageQueue->enqueue($flashMessage);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment