Issue Bug Closed

#59368Nested Flexforms throw Exception

Thomas Christiansen 06/05/14, 15:55 updated 10/02/18, 11:56

Description

Having a nested Flexform results in this Exception:

Uncaught TYPO3 Exception
#1: PHP Warning: substr() expects parameter 1 to be string, array given in /var/www/dev.e-net.info/vhosts/caretaker/caretaker/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 2272 (More information)

TYPO3\CMS\Core\Error\Exception thrown in file
/var/www/dev.e-net.info/vhosts/caretaker/caretaker/typo3_src/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 111.

15 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, “substr() expects parameter 1 to be string, array given”, “/var/www/dev.e-net.info/vhosts/caretaker/caretaker…po3/sysext/core/Classes/Utility/GeneralUtility.php”, 2272, array)
14 substr(array, 0, 200)

/var/www/dev.e-net.info/vhosts/caretaker/caretaker/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
02270: // Default output charset is UTF-8, only ASCII, ISO-8859-1 and UTF-8 are supported!!!
02271: $match = array();
02272: preg_match(‘/^[[:space:]]*<\\?xml[>]*encoding[[:space:]]*=[[:space:]]*”([”]*)”/’, substr($string, 0, 200), $match);
02273: $theCharset = $match1 ?: ‘utf-8’;
02274: // us-ascii / utf-8 / iso-8859-1

You might think why should i do that, but as you can see i am trying to get caretaker to work with 6.2. and it uses nested Flexforms to override test configurations.

Additionally i made a little test record to reproduce this behavior:

TCA:
…

‘flexform’ => array (
‘label’ => ‘Flexform’,
‘config’ => Array (
‘type’ => ‘flex’,
‘ds’ => array(
‘default’ => ‘
<t3datastructure><br> <root><br> <type>array</type><br> <el><br> <xmltitle><br> <tceforms><br> <label>The Title:</label><br> <config><br> <type>input</type><br> <size>48</size><br> </config><br> </tceforms><br> </xmltitle><br> <flex><br> <tceforms><br> <label>Nested Flexform</label><br> <config><br> <type>flex</type><br> <ds><br> <default>FILE:EXT:myext/Configuration/FlexForms/nested_flexform.xml</default><br> </ds><br> </config><br> </tceforms><br> </flex><br> </el><br> </root><br> </t3datastructure>
‘,
)
)
),

…

I already fixed this issue for me and i am going to push the patch to the review server in a minute.

Thanks,
Thomas

Reviews 2