Bug #69056
closedDataHandler - Illegal string offset 'currentLangId'
100%
Description
CMS 7.5-dev
Affected method TYPO3\CMS\Core\DataHandling\DataHandler::checkValueForFlex()
#1: PHP Warning: Illegal string offset 'currentLangId' in /Users/jok/Sites/_typo3_srcs/typo3_src-7.4.0/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 2449
How to reproduce:
You need a CE type plugin, with XML data, stored in DB tt_content.pi_flexform (fx felogin) with an empty <meta></meta> element.
The XML data structure would not contain any </meta> elements. Add an empty <meta><meta> element to the XML data.
In my case this emty <meta/> element extant from earlier CMS 4.x versions (fx. EXT:newloginbox).
If so, you cant save this CE, during method checkValueForFlex() fails.
How to solve:
A) Alter (wrong) database items
Find such CE elements, and alter the XML data, to remove empty meta> elements.
SELECT uid,pid,header,pi_flexform FROM tt_content WHERE pi_flexform LIKE '%<meta>%'
B) Bugfix DataHandler php issue
Change condition for unset 'currentLangId' value in TYPO3\CMS\Core\DataHandling\DataHandler::checkValueForFlex() line 2449
from
is_array($currentValueArray['meta']['currentLangId'])
to
isset($currentValueArray['meta']['currentLangId'])
which solves PHP warning for array key, which not exists.