Skip to content
Snippets Groups Projects
Commit a7bc75b4 authored by Thomas Hohn's avatar Thomas Hohn Committed by Christian Kuhn
Browse files

[BUGFIX] Fix PHP 8 warning in RootlineUtility

Sanitize the mountPointParameter in class constructor.

Resolves: #99731
Releases: main, 11.5
Change-Id: Ic6fec228c462c7ec4a75a7efc934d7d17fc5c1e0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77657


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 25c504c3
Branches
Tags
No related merge requests found
......@@ -133,7 +133,7 @@ class RootlineUtility
*/
public function __construct($uid, $mountPointParameter = '', $context = null)
{
$this->mountPointParameter = trim((string)$mountPointParameter);
$this->mountPointParameter = $this->sanitizeMountPointParameter($mountPointParameter);
if (!($context instanceof Context)) {
$context = GeneralUtility::makeInstance(Context::class);
}
......@@ -419,6 +419,23 @@ class RootlineUtility
return $mountedPageData;
}
/**
* Sanitize the MountPoint Parameter
* Splits the MP-Param via "," and removes mountpoints
* that don't have the format \d+-\d+
*/
protected function sanitizeMountPointParameter(string $mountPointParameter): string
{
$mountPoints = GeneralUtility::trimExplode(',', $mountPointParameter);
foreach ($mountPoints as $key => $mP) {
// If MP has incorrect format, discard it
if (!preg_match('/^\d+-\d+$/', $mP)) {
unset($mountPoints[$key]);
}
}
return implode(',', $mountPoints);
}
/**
* Parse the MountPoint Parameters
* Splits the MP-Param via "," for several nested mountpoints
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment