[TASK] Deprecate GeneralUtility::array_merge() 77/36377/4
authorGöran Bodenschatz <coding@46halbe.de>
Thu, 29 Jan 2015 17:51:46 +0000 (18:51 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Thu, 29 Jan 2015 20:24:51 +0000 (21:24 +0100)
1. Mark and log as deprecated
2. Change function call throughout Core to native php '+' operator

Resolves: #64596
Releases: master
Change-Id: I389a794352d2e5f37f284448884cd6077fb018c8
Reviewed-on: http://review.typo3.org/36377
Reviewed-by: Zbigniew Jacko <z.jacko@macopedia.pl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Form/Element/SuggestElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Html/HtmlParser.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
typo3/sysext/version/Classes/Hook/DataHandlerHook.php

index 64c12ed..1e0e570 100644 (file)
@@ -283,7 +283,7 @@ class SuggestElement {
                        if (empty($rows)) {
                                continue;
                        }
-                       $resultRows = GeneralUtility::array_merge($resultRows, $rows);
+                       $resultRows = $rows + $resultRows;
                        unset($rows);
                }
                $listItems = array();
index e457025..3122f70 100644 (file)
@@ -1871,7 +1871,6 @@ class FormEngine {
                        }
                }
                ksort($newFields);
-               // Candidate for GeneralUtility::array_merge() if integer-keys will some day make trouble...
                $fields = array_merge($newFields, $fields);
                return $fields;
        }
index 4ec0b51..715dcea 100644 (file)
@@ -2249,7 +2249,7 @@ class DataHandler {
                                                        }
                                                        unset($valueArray[$idx]);
                                                }
-                                               $valueArray = GeneralUtility::array_merge($newValueArray, $valueArray);
+                                               $valueArray = $valueArray + $newValueArray;
                                        }
                                } elseif (is_array($actionCMDs[$key]) && isset($valueArray[$key])) {
                                        $this->_ACTION_FLEX_FORMdata($valueArray[$key], $actionCMDs[$key]);
index dce780c..7fab0b2 100644 (file)
@@ -1337,7 +1337,6 @@ class HtmlParser {
                                                                        $keepTags[$key]['fixAttrib'][$atName] = array();
                                                                }
                                                                $keepTags[$key]['fixAttrib'][$atName] = array_merge($keepTags[$key]['fixAttrib'][$atName], $atConfig);
-                                                               // Candidate for \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge() if integer-keys will some day make trouble...
                                                                if ((string)$keepTags[$key]['fixAttrib'][$atName]['range'] !== '') {
                                                                        $keepTags[$key]['fixAttrib'][$atName]['range'] = GeneralUtility::trimExplode(',', $keepTags[$key]['fixAttrib'][$atName]['range']);
                                                                }
@@ -1349,7 +1348,6 @@ class HtmlParser {
                                        }
                                        unset($tagC['fixAttrib.']);
                                        unset($tagC['fixAttrib']);
-                                       // Candidate for \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge() if integer-keys will some day make trouble...
                                        $keepTags[$key] = array_merge($keepTags[$key], $tagC);
                                }
                        }
index a47751c..b5336e2 100755 (executable)
@@ -1754,8 +1754,10 @@ class GeneralUtility {
         * @param array $arr1 First array
         * @param array $arr2 Second array
         * @return array Merged result.
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8  - native php '+' operator instead
         */
        static public function array_merge(array $arr1, array $arr2) {
+               static::logDeprecatedFunction();
                return $arr2 + $arr1;
        }
 
index 07dc2a1..67957ef 100644 (file)
@@ -291,7 +291,7 @@ class FrontendUserAuthentication extends \TYPO3\CMS\Core\Authentication\Abstract
                        $groupData = $serviceObj->getGroups($this->user, $groupDataArr);
                        if (is_array($groupData) && count($groupData)) {
                                // Keys in $groupData should be unique ids of the groups (like "uid") so this function will override groups.
-                               $groupDataArr = GeneralUtility::array_merge($groupDataArr, $groupData);
+                               $groupDataArr = $groupData + $groupDataArr;
                        }
                        unset($serviceObj);
                }
index 1cddc5c..c30a579 100644 (file)
@@ -133,7 +133,6 @@ class AdminPanelView {
                if (is_array($input)) {
                        // Setting
                        $GLOBALS['BE_USER']->uc['TSFE_adminConfig'] = array_merge(!is_array($GLOBALS['BE_USER']->uc['TSFE_adminConfig']) ? array() : $GLOBALS['BE_USER']->uc['TSFE_adminConfig'], $input);
-                       // Candidate for GeneralUtility::array_merge() if integer-keys will some day make trouble...
                        unset($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['action']);
                        // Actions:
                        if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache')) {
index 5685018..0d121ee 100644 (file)
@@ -412,7 +412,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
                                );
                                $newMarkers = GeneralUtility::callUserFunction($userFunc, $params, $this);
                                if (is_array($newMarkers)) {
-                                       $markerArray = GeneralUtility::array_merge($markerArray, $newMarkers);
+                                       $markerArray = $newMarkers + $markerArray;
                                }
                                unset($params);
                        }
@@ -484,7 +484,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask {
                                );
                                $newMarkers = GeneralUtility::callUserFunction($userFunc, $params, $this);
                                if (is_array($newMarkers)) {
-                                       $markerArray = GeneralUtility::array_merge($markerArray, $newMarkers);
+                                       $markerArray = $newMarkers + $markerArray;
                                }
                                unset($params);
                        }
index 6a2e48c..fbe3223 100644 (file)
@@ -468,7 +468,7 @@ class DataHandlerHook {
                                                                        // Find all implicated since the last stage-raise from editing to review:
                                                                        foreach ($rows as $dat) {
                                                                                $data = unserialize($dat['log_data']);
-                                                                               $emails = GeneralUtility::array_merge($emails, $this->getEmailsForStageChangeNotification($dat['userid'], TRUE));
+                                                                               $emails = $this->getEmailsForStageChangeNotification($dat['userid'], TRUE) + $emails;
                                                                                if ($data['stage'] == 1) {
                                                                                        break;
                                                                                }
@@ -484,8 +484,8 @@ class DataHandlerHook {
                                                break;
                                        case 10:
                                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
-                                               $emails = GeneralUtility::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']));
-                                               $emails = GeneralUtility::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['members']));
+                                               $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']) + $emails;
+                                               $emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']) + $emails;
                                                break;
                                        default:
                                                // Do nothing