[FEATURE] Speedup trimExplode with limit 47/36647/2
authorAlexander Opitz <opitz.alexander@googlemail.com>
Wed, 4 Feb 2015 11:22:56 +0000 (12:22 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 4 Feb 2015 18:10:18 +0000 (19:10 +0100)
Using array_splice instead of array_slice two times.

Resolves: #64848
Releases: master
Change-Id: Iaa998c810aa94e1b3b547714ed4b431b0e5c8452
Reviewed-on: http://review.typo3.org/36647
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Frederic Gaus <gaus@flagbit.de>
Tested-by: Frederic Gaus <gaus@flagbit.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index a2bec98..a04155b 100755 (executable)
@@ -1482,8 +1482,7 @@ class GeneralUtility {
                        $result = $temp;
                }
                if ($limit > 0 && count($result) > $limit) {
-                       $lastElements = array_slice($result, $limit - 1);
-                       $result = array_slice($result, 0, $limit - 1);
+                       $lastElements = array_splice($result, $limit - 1);
                        $result[] = implode($delim, $lastElements);
                } elseif ($limit < 0) {
                        $result = array_slice($result, 0, $limit);