Issue Bug Closed

#69056DataHandler - Illegal string offset 'currentLangId'

Joerg Kummer 08/14/15, 13:00 updated 10/02/18, 11:34

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 element.
The XML data structure would not contain any elements. Add an empty element to the XML data.
In my case this emty 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 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.

Reviews 2