From 1ee881f60f0a6a9bc5b36a0fc3458e8f60818a6e Mon Sep 17 00:00:00 2001
From: Benjamin Franzke <ben@bnf.dev>
Date: Mon, 6 Nov 2023 19:17:08 +0100
Subject: [PATCH] [BUGFIX] Fix possible regression in cObjGet()

With #99503 `cObjGet()` was implemented as a wrapper around
the strictly typed cObjGetSeparated method, effectively
enforcing the first argument to be an array, while
previously non array values were returned as an empty string.

Resolves: #102328
Related: #99503
Releases: main, 12.4, 11.5
Change-Id: I7c04307f14da5a93e12672b36de163071dad7359
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81662
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benjamin Franzke <ben@bnf.dev>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
---
 .../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 e3d7a8246699..6147b4ec8f6b 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
@@ -687,6 +687,9 @@ class ContentObjectRenderer implements LoggerAwareInterface
      */
     public function cObjGet($setup, $addKey = '')
     {
+        if (!is_array($setup)) {
+            return '';
+        }
         return implode('', $this->cObjGetSeparated($setup, $addKey));
     }
 
@@ -698,7 +701,7 @@ class ContentObjectRenderer implements LoggerAwareInterface
      */
     public function cObjGetSeparated(?array $setup, string $addKey = ''): array
     {
-        if (!is_array($setup) || $setup === []) {
+        if ($setup === null || $setup === []) {
             return [];
         }
         $sKeyArray = ArrayUtility::filterAndSortByNumericKeys($setup);
-- 
GitLab