Issue Bug Closed

#98337 Undefined array key "_CURRENT_VERSION" in WorkspaceVersionRecordsCommand

Daniel Siepmann 09/13/22, 03:09 updated 10/04/22, 08:54

Description

After updating from PHP 7.4 to 8.0 my cronjob throws this exception when calling scheduler task:

 [WARNING] PHP Warning: Undefined array key "_CURRENT_VERSION" in               
           /typo3/sysext/workspaces/Classes/Command/WorkspaceVersionRecordsCommand.php line 304

After debugging the mentions line 304, I found the cause in a condition, which is not PHP 8 compatible, because the array key doesn’t exists in some cases:

if (!$verRec['_CURRENT_VERSION']) {

To fix this issue it can just be changed to the following, since the value of this key can only be “true” or not set (see previous BackendUtility::selectVersionsOfRecord method):

if (!isset($verRec['_CURRENT_VERSION'])) {

Reviews 2