From d42f15867a8a09f58fd586c2f2790db7726433f0 Mon Sep 17 00:00:00 2001 From: Markus Klein <markus.klein@typo3.org> Date: Fri, 17 Dec 2021 21:31:27 +0100 Subject: [PATCH] [BUGFIX] Make RichTextElement PHP 8 compatible RTE yaml configuration can be incomplete/wrong or empty. Do not access configuration settings without a safeguard. Resolves: #96383 Releases: main, 11.5 Change-Id: Ie0888402e64a669816edd200d2d54e401e0c399f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72702 Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by: Simon Gilli <typo3@gilbertsoft.org> Reviewed-by: Oliver Bartsch <bo@cedev.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Simon Gilli <typo3@gilbertsoft.org> Tested-by: Oliver Bartsch <bo@cedev.de> --- .../rte_ckeditor/Classes/Form/Element/RichTextElement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php b/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php index 0c649737ccc5..aaa91ec39dfd 100644 --- a/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php +++ b/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php @@ -161,7 +161,7 @@ class RichTextElement extends AbstractFormElement $resultArray['html'] = implode(LF, $html); - $this->rteConfiguration = $config['richtextConfiguration']['editor']; + $this->rteConfiguration = $config['richtextConfiguration']['editor'] ?? []; $resultArray['requireJsModules'][] = $this->loadCkEditorRequireJsModule($fieldId); return $resultArray; @@ -347,7 +347,7 @@ class RichTextElement extends AbstractFormElement 'customConfig' => '', ]; - if (is_array($this->rteConfiguration['config'])) { + if (is_array($this->rteConfiguration['config'] ?? null)) { $configuration = array_replace_recursive($configuration, $this->rteConfiguration['config']); } -- GitLab