[BUGFIX] Fix strict type error in recursive mount point resolving 16/59916/4
authorBenni Mack <benni@typo3.org>
Thu, 7 Mar 2019 21:02:46 +0000 (22:02 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 8 Mar 2019 12:14:11 +0000 (13:14 +0100)
PageLinkBuilder::populateMountPointMapForPageRecursively() requires
the $id parameter to be an integer, so this is cast properly now.

In addition, one regression is fixed where
"config.MP_mapRootPoints = root" was set, the proper variables
are now used.

Resolves: #87547
Resolves: #87473
Releases: master, 9.5
Change-Id: I899120d301309d768b9e498ad7f4ec96b9618b9d
Reviewed-on: https://review.typo3.org/c/59916
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php

index e17f832..5df6387 100644 (file)
@@ -640,11 +640,11 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
             if ($p === 'root') {
                 $rootPage = $this->getTypoScriptFrontendController()->tmpl->rootLine[0];
                 $p = $rootPage['uid'];
-                if ($p['_MOUNT_OL'] && $p['_MP_PARAM']) {
-                    $initMParray[] = $p['_MP_PARAM'];
+                if ($rootPage['_MOUNT_OL'] && $rootPage['_MP_PARAM']) {
+                    $initMParray[] = $rootPage['_MP_PARAM'];
                 }
             }
-            $this->populateMountPointMapForPageRecursively($mountPointMap, $p, $initMParray);
+            $this->populateMountPointMapForPageRecursively($mountPointMap, (int)$p, $initMParray);
         }
         $runtimeCache->set('pageLinkBuilderMountPointMap', $mountPointMap);
         return $mountPointMap;
@@ -708,13 +708,13 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
                 )->execute();
             while ($row = $queryResult->fetch()) {
                 // Find mount point if any:
-                $next_id = $row['uid'];
+                $next_id = (int)$row['uid'];
                 $next_MP_array = $MP_array;
                 $mount_info = $this->getTypoScriptFrontendController()->sys_page->getMountPointInfo($next_id, $row);
                 // Overlay mode:
                 if (is_array($mount_info) && $mount_info['overlay']) {
                     $next_MP_array[] = $mount_info['MPvar'];
-                    $next_id = $mount_info['mount_pid'];
+                    $next_id = (int)$mount_info['mount_pid'];
                 }
                 if (!isset($mountPointMap[$next_id])) {
                     // Set mapping information for this level:
@@ -722,7 +722,7 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
                     // Normal mode:
                     if (is_array($mount_info) && !$mount_info['overlay']) {
                         $next_MP_array[] = $mount_info['MPvar'];
-                        $next_id = $mount_info['mount_pid'];
+                        $next_id = (int)$mount_info['mount_pid'];
                     }
                     // Register recursive call
                     // (have to do it this way since ALL of the current level should be registered BEFORE the sublevel at any time)