[BUGFIX] Fix PHP warning in BackendUtility::getProcessedValue() 43/31243/2
authorMarkus Klein <klein.t3@mfc-linz.at>
Mon, 30 Jun 2014 11:06:42 +0000 (13:06 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 1 Jul 2014 18:04:56 +0000 (20:04 +0200)
BackendUtility::getProcessedValue() fails to initialize a variable which
causes a PHP warning on array access.

Fix this by initializing the variable to array properly.

Resolves: #59994
Releases: 6.3, 6.2
Change-Id: I26711b512a9a7fad40000de6f2de6a2b4a81ac75
Reviewed-on: https://review.typo3.org/31243
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 0b352e0..cc05a32 100644 (file)
@@ -2046,6 +2046,7 @@ class BackendUtility {
                                                        $selectUids = $dbGroup->tableArray[$theColConf['foreign_table']];
                                                        if (is_array($selectUids) && count($selectUids) > 0) {
                                                                $MMres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, ' . $MMfield, $theColConf['foreign_table'], 'uid IN (' . implode(',', $selectUids) . ')' . self::deleteClause($theColConf['foreign_table']));
+                                                               $mmlA = array();
                                                                while ($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
                                                                        // Keep sorting of $selectUids
                                                                        $mmlA[array_search($MMrow['uid'], $selectUids)] = $noRecordLookup ?
@@ -2053,8 +2054,8 @@ class BackendUtility {
                                                                                self::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult);
                                                                }
                                                                $GLOBALS['TYPO3_DB']->sql_free_result($MMres);
-                                                               ksort($mmlA);
-                                                               if (is_array($mmlA)) {
+                                                               if (!empty($mmlA)) {
+                                                                       ksort($mmlA);
                                                                        $l = implode('; ', $mmlA);
                                                                } else {
                                                                        $l = 'N/A';