From 25c504c3285b0245483691dbab37d3721fa0932e Mon Sep 17 00:00:00 2001 From: Thomas Hohn <thomas@hohn.dk> Date: Mon, 30 Jan 2023 15:29:57 +0100 Subject: [PATCH] [BUGFIX] Fix PHP 8 warning in ContentObjectRenderer Added a guard around the calculation of $sameBeginEnd. Resolves: #99752 Releases: main, 11.5 Change-Id: I754b4e67b2b04db20dc9adb8ee26bbd2ab2651ad Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77581 Tested-by: Nikita Hovratov <nikita.h@live.de> Reviewed-by: Nikita Hovratov <nikita.h@live.de> Tested-by: core-ci <typo3@b13.com> --- .../frontend/Classes/ContentObject/ContentObjectRenderer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 0128fc4ef213..1b7caca162fb 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -3847,7 +3847,10 @@ class ContentObjectRenderer implements LoggerAwareInterface // decode HTML entities, they're encoded later again $attrib = GeneralUtility::get_tag_attributes('<' . $fwParts[0] . '>', true); $str_content = $backParts[0]; - $sameBeginEnd = substr(strtolower($backParts[1]), 1, strlen($tagName)) === strtolower($tagName); + // Ensure that $backParts could be exploded into 2 items + if (isset($backParts[1])) { + $sameBeginEnd = strtolower(substr($backParts[1], 1, strlen($tagName))) === strtolower($tagName); + } } } if ($sameBeginEnd && in_array(strtolower($tagName), $encapTags)) { -- GitLab