[BUGFIX] RootlineUtility wrongly handles group-type fields 93/29493/6
authorFrancois Suter <francois@typo3.org>
Tue, 15 Apr 2014 19:48:16 +0000 (21:48 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 11 Sep 2014 14:29:32 +0000 (16:29 +0200)
\TYPO3\CMS\Core\Utility\RootlineUtility::enrichWithRelationFields()
tries to resolve relations to the current page record, including
fields with MM-relations. But it wrongly tests only for the
"foreign_table" property, whereas group-type fields will use the
"allowed" property.

This patch checks for "allowed" first and falls back on
"foreign_table". Furthermore a check is added to ensure the final
implode is indeed working on an array.

Resolves: #50396
Releases: 6.3, 6.2, 6.1
Change-Id: I43427061a5051298a25e45584aa995846ebb877c
Reviewed-on: http://review.typo3.org/29493
Reviewed-by: Jacob Rasmussen <jacob@omnius.dk>
Tested-by: Jacob Rasmussen <jacob@omnius.dk>
Reviewed-by: Mattias Nilsson <tollepjaer@gmail.com>
Tested-by: Mattias Nilsson <tollepjaer@gmail.com>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/Utility/RootlineUtility.php

index f9dc672..6739486 100644 (file)
@@ -274,8 +274,17 @@ class RootlineUtility {
                                if ($configuration['MM']) {
                                        /** @var $loadDBGroup \TYPO3\CMS\Core\Database\RelationHandler */
                                        $loadDBGroup = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
-                                       $loadDBGroup->start($pageRecord[$column], $configuration['foreign_table'], $configuration['MM'], $uid, 'pages', $configuration);
-                                       $relatedUids = $loadDBGroup->tableArray[$configuration['foreign_table']];
+                                       $loadDBGroup->start(
+                                               $pageRecord[$column],
+                                               isset($configuration['allowed']) ? $configuration['allowed'] : $configuration['foreign_table'],
+                                               $configuration['MM'],
+                                               $uid,
+                                               'pages',
+                                               $configuration
+                                       );
+                                       $relatedUids = isset($loadDBGroup->tableArray[$configuration['foreign_table']])
+                                               ? $loadDBGroup->tableArray[$configuration['foreign_table']]
+                                               : array();
                                } else {
                                        $columnIsOverlaid = in_array($column, $pageOverlayFields, TRUE);
                                        $table = $configuration['foreign_table'];