Skip to content

Commit

Permalink
[BUGFIX] Fix possible regression in cObjGet()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bnf committed Nov 7, 2023
1 parent 50505bb commit 1ee881f
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -687,6 +687,9 @@ public function setCurrentVal($value)
*/
public function cObjGet($setup, $addKey = '')
{
if (!is_array($setup)) {
return '';
}
return implode('', $this->cObjGetSeparated($setup, $addKey));
}

Expand All @@ -698,7 +701,7 @@ public function cObjGet($setup, $addKey = '')
*/
public function cObjGetSeparated(?array $setup, string $addKey = ''): array
{
if (!is_array($setup) || $setup === []) {
if ($setup === null || $setup === []) {
return [];
}
$sKeyArray = ArrayUtility::filterAndSortByNumericKeys($setup);
Expand Down

0 comments on commit 1ee881f

Please sign in to comment.