Actions
Bug #104494
closed"Delete similar errors" for BeLog fails when detail_nr is 11/12 and serialized data with placeholders is used
Status:
Closed
Priority:
Should have
Assignee:
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