Project

General

Profile

Actions

Bug #56405

closed

GeneralUtility::revExplode returns unexpected result to getSingleField_typeFlex_draw()

Added by Georg Tiefenbrunn over 10 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
Start date:
2014-02-28
Due date:
% Done:

100%

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

Description

While testing fluid_content with the latest TYPO3 6.2 master from GIT I noticed that containers (add multiple objects) in flexforms do not work. This is caused by malformed IDs in hidden input fields and the JS-Code.

As a working reference I used 'Bootstrap: Tabs' from http://bootstrap.typo3cms.demo.typo3.org/ (Page id=110, tt_content uid=344) running with TYPO3 6.1.7. An equal element is rendered in TYPO3 6.2 as

<input ... name="_ACTION_FLEX_FORMdata[tt_content][...][pi_flexform][data][tabs][lDEF][tabs][el][2]][_ACTION][" value="">

The malformed part is at the end: [el][2]][_ACTION]["

I tracked the problems down to \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode() which is called in
\TYPO3\CMS\Backend\Form\FormEngine::getSingleField_typeFlex_draw().

For $formPrefix = [data][tabs][lDEF][tabs][el][2]` the call $s = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('[]', $formPrefix, 2); in TYPO3 6.1 returns

$s = array
    0 => '[data][tabs][lDEF][tabs][el'
    1 => '2]'


TYPO3 6.2 returns
$s = array
    0 => '[data][tabs][lDEF][columns][el][2]'

Since https://git.typo3.org/Packages/TYPO3.CMS.git/commit/7da40c0b10057128c9c5e691cd155c7f255d537e there are two problems:

1) revExplode() behaves inconsitent if $string has more than one character. If $count === 2 we do not use strrev() (which is what I would expect). If $count <> 2 multicharacter delimiters break at other positions. Imho we should to distinguish between strlen($delimiter) == 1 and > 1.

2) getSingleField_typeFlex_draw() explodes string as [a][b][c] but defines [] as delimiter which ist totally misleading. Imho we should use the correct delimiter ][ (which at the moment only works with $count = 2).

After three hours of debugging I finally changed only three characters in \TYPO3\CMS\Backend\Form\FormEngine::getSingleField_typeFlex_draw() to get this working again:

-                            $s = GeneralUtility::revExplode('[]', $formPrefix, 2);
-                            $actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION][' . $s[1];
+                            $s = GeneralUtility::revExplode('][', $formPrefix, 2);
+                            $actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION]' . $s[1];


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #55564: Improve GeneralUtility::revExplode performanceClosedAndreas Wolf2014-02-01

Actions
Related to TYPO3 Core - Bug #55838: revExplode returns invalid values if no delimiter in stringClosedAlexander Stehlik2014-02-10

Actions
Actions

Also available in: Atom PDF