Issue Bug Closed

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

Ralph Brugger 09/30/22, 14:18 updated 10/04/22, 08:54

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] : '';
    }

Reviews 2