Bug #98630
closedPHP Warning: Undefined array key foobar in typo3_src-11.5.17/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php line 1394
100%
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;
}
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] : '';
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
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
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
Updated by Benni Mack almost 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 40486581519d9c3c4a24a48439dffff67626fb12.