Project

General

Profile

Actions

Bug #70972

closed

Story #69617: FormEngine bugs

translated CE with FAL-relation throws error within flexform

Added by Patrick Astor over 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2015-10-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Related file: typo3_src/typo3/sysext/backend/Classes/Form/InlineRelatedRecordResolver.php

When trying to edit a translation-copy of a content-element with an fal-relation inside a flexform, we get an error,
because the core is trying to transform an xml to an array twice.

Example to reproduce:
- create Content-Element
- add an flexform which contains an element of type 'inline'
- add the CE to a page
- translate it
- try to edit the translation.

Uncaught TYPO3 Exception
#1: PHP Warning: substr() expects parameter 1 to be string, array given in /var/www/sources/typo3_src-7.5.0/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 2146 (More information)

TYPO3\CMS\Core\Error\Exception thrown in file
/var/www/sources/typo3_src-7.5.0/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 107.

25 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "substr() expects parameter 1 to be string, array given", "/var/www/sources/typo3_src-7.5.0/typo3/sysext/core/Classes/Utility/GeneralUtility.php", 2146, array)
24 substr(array, 0, 200)

/var/www/sources/typo3_src-7.5.0/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
02144:   // Default output charset is UTF-8, only ASCII, ISO-8859-1 and UTF-8 are supported!!!
02145:   $match = array();
02146:   preg_match('/^[[:space:]]*<\\?xml[^>]*encoding[[:space:]]*=[[:space:]]*"([^"]*)"/', substr($string, 0, 200), $match);
02147:   $theCharset = $match[1] ?: 'utf-8';
02148:   // us-ascii / utf-8 / iso-8859-1

23 TYPO3\CMS\Core\Utility\GeneralUtility::xml2arrayProcess(array, "", boolean)

/var/www/sources/typo3_src-7.5.0/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
02116:    $array = PageRepository::getHash($identifier, 0);
02117:    if (!is_array($array)) {
02118:     $array = self::xml2arrayProcess($string, $NSprefix, $reportDocTag);
02119:     PageRepository::storeHash($identifier, $array, 'ident_xml2array');
02120:    }

22 TYPO3\CMS\Core\Utility\GeneralUtility::xml2array(array)

/var/www/sources/typo3_src-7.5.0/typo3/sysext/backend/Classes/Form/InlineRelatedRecordResolver.php:
00080:      if ($GLOBALS['TCA'][$table]['columns'][$field]['config']['type'] === 'flex') {
00081:       $flexFormParts = FormEngineUtility::extractFlexFormParts($PA['itemFormElName']);
00082:       $flexData = GeneralUtility::xml2array($fieldValue);
00083:       /** @var  $flexFormTools  FlexFormTools */
00084:       $flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);

Fix in the core helped:

typo3_src/typo3/sysext/backend/Classes/Form/InlineRelatedRecordResolver.php Row 82:
Old:
```
$flexData = GeneralUtility::xml2array($fieldValue);
```

New:
```
if (!is_array($fieldValue)) {
$flexData = GeneralUtility::xml2array($fieldValue);
} else {
$flexData = $fieldValue;
}
```

Actions #1

Updated by Christian Kuhn over 8 years ago

  • Parent task set to #69617
Actions #2

Updated by Christian Kuhn over 8 years ago

  • Category changed from 978 to FormEngine aka TCEforms
Actions #3

Updated by Mathias Schreiber over 8 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Mathias Schreiber

Hi patrick,

can you test again on latest master (or ideally provide the TCA for what you try to do)?

From what I can see this issue should be resolved on master

Actions #4

Updated by Riccardo De Contardi about 8 years ago

  • Status changed from Needs Feedback to Closed
  • Assignee deleted (Mathias Schreiber)
  • Target version deleted (7 LTS)

No feedback within the last 90 days => closing this issue.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

You could also join the #typo3-cms channel in Slack if you still need support.
Thank you

Actions #5

Updated by Christian Kuhn almost 8 years ago

  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF