Bug #92501
closedTYPO3 v9 Migration-Class SeparateSysHistoryFromSysLogUpdate causes exception on invalid log-data entries
0%
Description
I've been running TYPO3 Migration through TYPO3 v9 and Upgrade-Wizard caused Exception in Migation 'SeparateSysHistoryFromSysLogUpdate'.
Caused by this piece of code in method moveDataFromSysLogToSysHistory
$logData = $row['log_data'] !== null ? (array)unserialize($row['log_data'], ['allowed_classes' => false]) : [];
Later on calling the method updateTablesAndTrackProgress will rise an exception, as in my case for some reason the 'log_data' was not unserializeable, but the function expects this argument to be an array!
There are two points how this cloud be fixed and improved fixed:
1. Improve unserialize (code pieve aboce) like this, as it is more failure proof and better concept of code-handling:
@
$logData = [];
if($row['log_data'] !== null)
{
$logData = (array)unserialize($row['log_data'], ['allowed_classes' => false]);
}
@
or even better and cleaner:
@
$logData = [];
if($row['log_data'] !== null)
{
if(!!($tmp = (array)unserialize($row['log_data'], ['allowed_classes' => false]))
{
$row['log_data'] = $tmp;
}
}
@
2. there's already a try/catch around updateTablesAndTrackProgress,
but we could catch the TypeError separately and may be create some kind of logging or report which records where failing.
Simply add this right before the existing catch \Exception
} catch (\TypeError $e) {
// ignore, log, create report for Migration?!
} catch (\Exception $up) {
$connection->rollBack();
throw ($up);
}
Updated by Markus Klein about 4 years ago
- Is duplicate of Bug #91042: SeparateSysHistoryFromSysLog upgrade wizard type error added
Updated by Markus Klein about 4 years ago
- Status changed from New to Closed
Closing this as duplicate.