Project

General

Profile

Actions

Bug #98630

closed

PHP Warning: Undefined array key foobar in typo3_src-11.5.17/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php line 1394

Added by Ralph Brugger about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2022-10-17
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

PHP Warning: Undefined array key foobar in typo3_src-11.5.17/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php line 1394

    public function pi_getFFvalue($T3FlexForm_array, $fieldName, $sheet = 'sDEF', $lang = 'lDEF', $value = 'vDEF')
    {
        $sheetArray = is_array($T3FlexForm_array) ? $T3FlexForm_array['data'][$sheet][$lang] : '';

The warning occures when the stored flexform data doesn't contain a flexform sheet ($sheet) that has been added to a flexform but the record is outdated.

Solution could be?

public function pi_getFFvalue($T3FlexForm_array, $fieldName, $sheet = 'sDEF', $lang = 'lDEF', $value = 'vDEF')
{

    if (isset($T3FlexForm_array['data'][$sheet])){

      $sheetArray = is_array($T3FlexForm_array) ? $T3FlexForm_array['data'][$sheet][$lang] : '';
      if (is_array($sheetArray)) {
          return $this->pi_getFFvalueFromSheetArray($sheetArray, explode('/', $fieldName), $value);
      }
    }
    return null;
}

Actions #1

Updated by Ralph Brugger about 2 years ago

  • Description updated (diff)
Actions #2

Updated by Christian Hackl almost 2 years ago

I think a little bit better:

$sheetArray = (is_array($T3FlexForm_array) && isset($T3FlexForm_array['data'][$sheet][$lang])) ? $T3FlexForm_array['data'][$sheet][$lang] : '';

theoretically, the following should also suffice:

$sheetArray = isset($T3FlexForm_array['data'][$sheet][$lang]) ? $T3FlexForm_array['data'][$sheet][$lang] : '';

Actions #3

Updated by Gerrit Code Review almost 2 years 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/+/77565

Actions #4

Updated by Gerrit Code Review almost 2 years ago

Patch set 2 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/+/77565

Actions #5

Updated by Gerrit Code Review almost 2 years ago

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

Actions #6

Updated by Benni Mack almost 2 years ago

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

Updated by Benni Mack almost 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF