[TASK] Lower memory use in ArrayUtil->mergeRecursiveWithOverrule 51/35351/5
authorStephan Großberndt <stephan@grossberndt.de>
Fri, 12 Dec 2014 13:58:17 +0000 (14:58 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 17 Dec 2014 08:01:13 +0000 (09:01 +0100)
Iterate on the original array instead of an array_keys()-copy in
ArrayUtil->mergeRecursiveWithOverrule which lowers memory usage and
enhances performance.

Resolves: #63812
Releases: master, 6.2
Change-Id: I71acc9e1e730f1e782d0e74acd45637ce1b9f08e
Reviewed-on: http://review.typo3.org/35351
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Utility/ArrayUtility.php

index d29899b..74ea341 100644 (file)
@@ -517,7 +517,7 @@ class ArrayUtility {
         * @return void
         */
        static public function mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) {
-               foreach (array_keys($overrule) as $key) {
+               foreach ($overrule as $key => $unusedValue) {
                        if ($enableUnsetFeature && $overrule[$key] === '__UNSET') {
                                unset($original[$key]);
                                continue;