Issue Bug Closed

#102328Regression in cObjGet

Benjamin Franzke 11/06/23, 18:21 updated 07/09/24, 15:19

Description

Reported by Rafael Kähm in https://forge.typo3.org/issues/99503#note-13

> Please reopen, because applied patch makes unnecessary BC at least on 11.5.
> See:


    public function cObjGet($setup, $addKey = '')
    {
        return implode('', $this->cObjGetSeparated($setup, $addKey));
    }

    public function cObjGetSeparated(?array $setup, string $addKey = ''): array
    {
        if (!is_array($setup) || $setup === []) {
            return [];
        }

> Proposal:

    public function cObjGet($setup, $addKey = '')
    {
        if (!is_array($setup)) {
            return '';
        }
        return implode('', $this->cObjGetSeparated($setup, $addKey));
    }

    public function cObjGetSeparated(?array $setup = [], string $addKey = ''): array
    {
        if (empty($setup)) {
            return [];
        }
    }

Reviews 3