Commit 028e6a7a authored by Thomas Hohn's avatar Thomas Hohn Committed by Stefan Bürk
Browse files

[BUGFIX] Fix PHP 8 warning in ContentObjectRenderer

Since $conf['externalBlocks.'][$tagName . '.'] can be null, added a null
coalescing check to ensure that $cfg contains a valid value.

Resolves: #99706
Releases: main, 11.5
Change-Id: Ia80bc50504e27eb0155232e1f1eb956f9b88ac79
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77593


Reviewed-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 2412c79d
......@@ -3113,7 +3113,10 @@ class ContentObjectRenderer implements LoggerAwareInterface
if ($k % 2) {
// font:
$tagName = strtolower($htmlParser->getFirstTagName($v));
$cfg = $conf['externalBlocks.'][$tagName . '.'];
$cfg = $conf['externalBlocks.'][$tagName . '.'] ?? [];
if ($cfg === []) {
continue;
}
if (($cfg['stripNLprev'] ?? false) || ($cfg['stripNL'] ?? false)) {
$parts[$k - 1] = preg_replace('/' . CR . '?' . LF . '[ ]*$/', '', $parts[$k - 1]);
}
......@@ -3129,7 +3132,10 @@ class ContentObjectRenderer implements LoggerAwareInterface
if ($k % 2) {
$tag = $htmlParser->getFirstTag($v);
$tagName = strtolower($htmlParser->getFirstTagName($v));
$cfg = $conf['externalBlocks.'][$tagName . '.'];
$cfg = $conf['externalBlocks.'][$tagName . '.'] ?? [];
if ($cfg === []) {
continue;
}
if ($cfg['callRecursive'] ?? false) {
$parts[$k] = $this->parseFunc($htmlParser->removeFirstAndLastTag($v), $conf);
if (!($cfg['callRecursive.']['dontWrapSelf'] ?? false)) {
......
Supports Markdown
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