Skip to content

Commit

Permalink
[BUGFIX] Add type cast for potential mountpoint information
Browse files Browse the repository at this point in the history
Avoid exceptions by adding a type cast to string for the mount point
information. An additional early return avoids additional calls to
`\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode()`.

Resolves: #99946
Releases: main, 11.5
Change-Id: I18ea15c0f3e2c884e3333e55877e0f6dbe56c859
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77860
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Jochen <rothjochen@gmail.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Jochen <rothjochen@gmail.com>
  • Loading branch information
georgringer authored and o-ba committed Feb 15, 2023
1 parent 2115fe3 commit 6797361
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ protected function findPageCandidatesOfMountPoint(
$rootLine = GeneralUtility::makeInstance(
RootlineUtility::class,
$pageCandidate['uid'],
$pageCandidate['MPvar'],
(string)$pageCandidate['MPvar'],
$this->context
)->get();
foreach ($rootLine as $pageInRootLine) {
Expand Down
4 changes: 4 additions & 0 deletions typo3/sysext/core/Classes/Utility/RootlineUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ protected function processMountedPage(array $mountedPageData, array $mountPointP
*/
protected function sanitizeMountPointParameter(string $mountPointParameter): string
{
$mountPointParameter = trim($mountPointParameter);
if ($mountPointParameter === '') {
return '';
}
$mountPoints = GeneralUtility::trimExplode(',', $mountPointParameter);
foreach ($mountPoints as $key => $mP) {
// If MP has incorrect format, discard it
Expand Down

0 comments on commit 6797361

Please sign in to comment.