Project

General

Profile

Actions

Bug #104494

closed

"Delete similar errors" for BeLog fails when detail_nr is 11/12 and serialized data with placeholders is used

Added by Garvin Hicking 4 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Category:
Logging
Target version:
Start date:
2024-07-28
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Given a sys_log entry like this:

INSERT INTO `sys_log` (`uid`, `tstamp`, `userid`, `action`, `recuid`, `tablename`, `recpid`, `error`, `details`, `type`, `details_nr`, `IP`, `log_data`, `event_pid`, `workspace`, `NEWid`, `request_id`, `time_micro`, `component`, `level`, `message`, `data`, `channel`)
VALUES
    (16666, 1722152496, 1, 2, 3, 'pages', 0, 2, 'SQL error: \"{reason}\" ({table}:{uid})', 1, 12, '172.18.0.5', '{\"reason\":\"Out of range value for column \'starttime\' at row 1\",\"table\":\"pages\",\"uid\":1030}', -1, 0, '', '', 0, '', 'info', NULL, NULL, 'content');

we have these special keys:

details_nr: 12
details: SQL error: "{reason}" ({table}:{uid})
log_data: {"reason":"Out of range value for column 'starttime' at row 1","table":"pages","uid":1030}

When using the button "delete similar errors" from BeLog an error is thrown with information about an "array to string" cast.

This is because the where constraint is filled like this:

        if (in_array($logEntry->getDetailsNumber(), [11, 12], true)) {
            $constraints[] = $queryBuilder->expr()->eq('log_data', $queryBuilder->createNamedParameter($logEntry->getLogData()));
        }

and then getLogData unserializes the data of log_data and fills that into the SQL query. Since it is an array bound to the named parameter for "log_data" this will fail.

As far as I can see, this special case for details 11,12 has always failed when "log_data" was filled with serialized data.

The bugfix for this is to not do all the unserializing magic, because the querybuilder should just use a query condition with the raw data.

Actions #1

Updated by Gerrit Code Review 4 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85402

Actions #2

Updated by Gerrit Code Review 4 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85414

Actions #3

Updated by Garvin Hicking 4 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF