[BUGFIX] Correctly resolve dots inside flexform field names 06/54806/2
authorChristian Weiske <weiske@mogic.com>
Tue, 10 Jan 2017 13:23:34 +0000 (14:23 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 27 Nov 2017 22:11:23 +0000 (23:11 +0100)
When a flexform field index attribute contained a dot, only
the last value was kept.
We now correctly append the new values to the existing ones now.

Change-Id: I73e541e834c143c33ba34f7e3f3ea7a22726b074
Resolves: #79245
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/54806
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/extbase/Classes/Service/FlexFormService.php
typo3/sysext/extbase/Tests/Unit/Service/FlexFormServiceTest.php

index a5c443c..6b1471a 100644 (file)
@@ -93,7 +93,8 @@ class FlexFormService implements \TYPO3\CMS\Core\SingletonInterface
                         $currentNode = &$currentNode[$nodeKeyParts[$i]];
                     }
                     $newNode = [next($nodeKeyParts) => $nodeValue];
-                    $currentNode = $this->walkFlexFormNode($newNode, $valuePointer);
+                    $subVal = $this->walkFlexFormNode($newNode, $valuePointer);
+                    $currentNode[key($subVal)] = current($subVal);
                 } elseif (is_array($nodeValue)) {
                     if (array_key_exists($valuePointer, $nodeValue)) {
                         $return[$nodeKey] = $nodeValue[$valuePointer];
index 37430ce..c3d3aba 100644 (file)
@@ -67,6 +67,12 @@ class FlexFormServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                                                                        <field index="bum">
                                                                                <value index="vDEF">Bum1-Value</value>
                                                                        </field>
+                                                                       <field index="dot.one">
+                                                                               <value index="vDEF">dot.one-Value</value>
+                                                                       </field>
+                                                                       <field index="dot.two">
+                                                                               <value index="vDEF">dot.two-Value</value>
+                                                                       </field>
                                                                </el>
                                                        </itemType>
                                                        <itemType index="_TOGGLE">0</itemType>
@@ -97,7 +103,11 @@ class FlexFormServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
                 'bar' => [
                     1 => [
                         'baz' => 'Baz1-Value',
-                        'bum' => 'Bum1-Value'
+                        'bum' => 'Bum1-Value',
+                        'dot' => [
+                            'one' => 'dot.one-Value',
+                            'two' => 'dot.two-Value',
+                        ],
                     ],
                     2 => [
                         'baz' => 'Baz2-Value',