#105195Flexform configuration already resolved to array causes errors in form rendering
Description
Error Message:
(1/1) TypeError
TYPO3\CMS\Core\Utility\GeneralUtility::xml2array(): Argument #1 ($string) must be of type string, array given, called in /var/www/html/vendor/typo3/cms-form/Classes/Controller/FormFrontendController.php on line 94
in /var/www/html/vendor/typo3/cms-core/Classes/Utility/GeneralUtility.php line 1264
* @return array|string If the parsing had errors, a string with the error message is returned. Otherwise an array with the content.
* @see array2xml()
* @see xml2arrayProcess()
*/
public static function xml2array(string $string, string $NSprefix = '', bool $reportDocTag = false): array|string
{
$runtimeCache = static::makeInstance(CacheManager::class)->getCache('runtime');
$firstLevelCache = $runtimeCache->get('generalUtilityXml2Array') ?: [];
$identifier = md5($string . $NSprefix . ($reportDocTag ? '1' : '0'));
at TYPO3\CMS\Core\Utility\GeneralUtility::xml2array(array(‘settings’ => array(‘persistenceIdentifier’ => ’1:/form_definitions/exampleofallFields.form.yaml’)))
in /var/www/html/vendor/typo3/cms-form/Classes/Controller/FormFrontendController.php line 94
* settings. For now, only finisher settings are overridable.
*/
protected function overrideByFlexFormSettings(array $formDefinition): array
{
$flexFormData = GeneralUtility::xml2array($this->request->getAttribute('currentContentObject')?->data['pi_flexform'] ?? '');
if (!is_array($flexFormData)) {
return $formDefinition;
}
if (isset($formDefinition['finishers'])) {
I think the cause is rooted in the newly introduced record resolving, as the error just came up after updating TYPO3 in my test project from 13.2 to 13.3.x. The pi_flexform field data is now already parsed to an array, but the form still expects a string here.
Reviews 2
Files 3
History 69
-
André Buchmann changed Related to #104514 10/04/24, 10:22
-
Gerrit Code Review pushed patch set 1 for main to change 86417 status
NewUnder Review 10/04/24, 11:24 -
André Buchmann changed
Related to #10451410/04/24, 11:29 -
André Buchmann changed description 10/04/24, 11:33
-
André Buchmann commented and changed attached clipboard-202410071102-r22ry.png attached clipboard-202410071122-e4ivi.png attached form_xml2array_test.zip 10/07/24, 09:26
-
Gerrit Code Review pushed patch set 2 for main to change 86417 10/08/24, 08:21
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 86512 10/08/24, 11:25
-
André Buchmann commented and changed status
Under ReviewResolved done0 %100 % 10/08/24, 11:35Applied in changeset commit:b7e342032205da0f8aae463cbb425bc31d00b5f4.
-
Benni Mack changed status
ResolvedClosed 10/15/24, 09:05
Test Setup
Result “Modern“
clipboard-202410071102-r22ry.png
Result “Classic“
clipboard-202410071122-e4ivi.png