Revert "[TASK] Avoid slow array functions in loops"
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Mvc / Web / RequestBuilder.php
index 49c8f28..5611fe4 100644 (file)
@@ -309,19 +309,18 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
     protected function untangleFilesArray(array $convolutedFiles)
     {
         $untangledFiles = [];
-        $fieldPaths = [[]];
+        $fieldPaths = [];
         foreach ($convolutedFiles as $firstLevelFieldName => $fieldInformation) {
             if (!is_array($fieldInformation['error'])) {
-                $fieldPaths[] = [[$firstLevelFieldName]];
+                $fieldPaths[] = [$firstLevelFieldName];
             } else {
                 $newFieldPaths = $this->calculateFieldPaths($fieldInformation['error'], $firstLevelFieldName);
                 array_walk($newFieldPaths, function (&$value, $key) {
                     $value = explode('/', $value);
                 });
-                $fieldPaths[] = $newFieldPaths;
+                $fieldPaths = array_merge($fieldPaths, $newFieldPaths);
             }
         }
-        $fieldPaths = array_merge(...$fieldPaths);
         foreach ($fieldPaths as $fieldPath) {
             if (count($fieldPath) === 1) {
                 $fileInformation = $convolutedFiles[$fieldPath[0]];