Issue Bug Closed

#90900TypeError: "trim() expects parameter 1 to be string, null given" in ConstantConfigurationParser

Julian Mair 03/31/20, 09:09 updated 04/21/20, 10:42

Description

If you add something like such in your constants:

# customcategory=generaldata=Allgemeine Einstellungen
general {
    # cat=generaldata; type=boolean; label= Automatische Sprachweiterleitung aktivieren (im Frontend)
    lang_redirect_active = 0
}

… then this error occours in the BE Constant Editor/Browser (this worked without problems in v8 and v9):

(1/1) TypeError
trim() expects parameter 1 to be string, null given

in /var/www/html/httpdocs/typo3/sysext/core/Classes/TypoScript/Parser/ConstantConfigurationParser.php line 296

            }
            if (isset($editableComments[$const])) {
                $editableComments[$const]['name'] = $const;
                $editableComments[$const]['value'] = trim($value);
                $editableComments[$const]['default_value'] = trim($default[$const]);
            }
        }
        return $editableComments;
    }

if a string conversion like `trim((string)$default[$const]);` is applied, the error disappears…

Reviews 1