Project

General

Profile

Actions

Bug #79426

closed

Method traverseFlexFormXMLData in TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools crashes with runtime error

Added by Thomas Hohn almost 8 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Code Cleanup
Target version:
Start date:
2017-01-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

The following code will crash with an runtime-error if $dataStructureArray['sheets'] is not an array

// Traverse languages:
foreach ($dataStructureArray['sheets'] as $sheetKey => $sheetData) {
    // Render sheet:
    if (is_array($sheetData['ROOT']) && is_array($sheetData['ROOT']['el'])) {
        $PA['vKeys'] = ['DEF'];
        $PA['lKey'] = 'lDEF';
        $PA['callBackMethod_value'] = $callBackMethod_value;
        $PA['table'] = $table;
        $PA['field'] = $field;
        $PA['uid'] = $row['uid'];
        // Render flexform:
    $this->traverseFlexFormXMLData_recurse($sheetData['ROOT']['el'], $editData['data'][$sheetKey]['lDEF'], $PA, 'data/' . $sheetKey . '/lDEF');
    } else {
        return 'Data Structure ERROR: No ROOT element found for sheet "' . $sheetKey . '".';
    }
}

It would ne nicer to add a check if $dataStructureArray is not an array and then return an error string

// Check if $dataStructureArray['sheets'] is indeed an array before loop or it will crash with runtime error
if (!is_array($dataStructureArray['sheets'])) {
    return 'Data Structure ERROR: sheets is defined but not an array for table ' . $table . (isset($row['uid']) ? ' and uid ' . $row['uid'] : '');
}
Actions #1

Updated by Thomas Hohn almost 8 years ago

  • Description updated (diff)
Actions #2

Updated by Thomas Hohn almost 8 years ago

  • Description updated (diff)
Actions #3

Updated by Gerrit Code Review almost 8 years ago

  • Status changed from New to Under Review

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

Actions #4

Updated by Gerrit Code Review almost 8 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51399

Actions #5

Updated by Benni Mack almost 8 years ago

  • Target version changed from 8.6 to 8 LTS
Actions #6

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51399

Actions #7

Updated by Thomas Hohn over 7 years ago

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

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF