Project

General

Profile

Actions

Bug #98483

closed

PHP Warning: Undefined array key "foolala" in typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php line 1425

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

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

100%

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

Description

If ypu're trying a flexform that is not stored in the current flexform data you will get:

$this->pi_getFFValue($this->cObj->data['pi_flexform'], "foolala", "sDEF");

This can happen after you've extended the flexform but did not save it everynwhere.
So the value is missing.

This wan't a problem under PHP 7.4 but with PHP 8 you'll get this warning:

PHP Warning: Undefined array key "foolala" in typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php line 1425

Maybe this way?


    public function pi_getFFvalueFromSheetArray($sheetArray, $fieldNameArr, $value)
    {
        $tempArr = $sheetArray;
        foreach ($fieldNameArr as $k => $v) {
            if (MathUtility::canBeInterpretedAsInteger($v)) {
                if (is_array($tempArr)) {
                    $c = 0;
                    foreach ($tempArr as $values) {
                        if ($c == $v) {
                            $tempArr = $values;
                            break;
                        }
                        $c++;
                    }
                }
            } else {
                if (isset($tempArr[$v])){
                $tempArr = $tempArr[$v];
                }
            }
        }

        return isset($tempArr[$value]) ?  $tempArr[$value] : '';
    }

Actions

Also available in: Atom PDF