From 8d476987e16159f2cca7bebbc8a73a0cdfec5dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20Schottm=C3=BCller?= Date: Mon, 13 Jun 2022 15:22:44 +0200 Subject: [PATCH] Fixed error that can occur with PHP 8 when a value is too short --- dca/tl_content.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dca/tl_content.php b/dca/tl_content.php index bf658b7..dc944bc 100644 --- a/dca/tl_content.php +++ b/dca/tl_content.php @@ -19,10 +19,13 @@ { if (strcmp($key, '__selector__') != 0) { - $pos = strpos($GLOBALS['TL_DCA']['tl_content']['palettes'][$key], '{', 2); - if ($pos !== FALSE) - { - $GLOBALS['TL_DCA']['tl_content']['palettes'][$key] = substr($GLOBALS['TL_DCA']['tl_content']['palettes'][$key],0,$pos) . "{tags_legend:hide},tags;" . substr($GLOBALS['TL_DCA']['tl_content']['palettes'][$key],$pos); + $value = $GLOBALS['TL_DCA']['tl_content']['palettes'][$key]; + if (strlen($value) >= 2) { + $pos = strpos($value, '{', 2); + if ($pos !== FALSE) + { + $GLOBALS['TL_DCA']['tl_content']['palettes'][$key] = substr($GLOBALS['TL_DCA']['tl_content']['palettes'][$key],0,$pos) . "{tags_legend:hide},tags;" . substr($GLOBALS['TL_DCA']['tl_content']['palettes'][$key],$pos); + } } } }