#67757Sanity check is missing within MediaContentObject
Description
In the file MediaContentObject.php Line 299 and Line 301 there are the sanity checks missing, which will trigger an PHP warning, which will produce an error.
https://typo3.org/api/typo3cms/_media_content_object_8php_source.html#l00299
https://typo3.org/api/typo3cms/_media_content_object_8php_source.html#l00301
The function explanation itself tells it will lookup the keys and if not present will use the defaults. <https: typo3.org api typo3cms></https:>
But it does not really checks for presence. It just assumes.
Original:
295 protected function doFlexFormOverlay(array &$confArray, $key, $sectionKey = NULL) {
296 $flexValue = NULL;
297 $flexKey = 'mm' . ucfirst($key);
298 if ($sectionKey === NULL) {
299 $flexValue = $confArray['parameter.'][$flexKey];
300 } else {
301 $flexValue = $confArray['parameter.'][$flexKey][$sectionKey];
302 }
303 if ($flexValue === NULL) {
304 $flexValue = isset($confArray[$key . '.']) ? $this->cObj->stdWrap($confArray[$key], $confArray[$key . '.']) : $confArray[$key];
305 }
306 return $flexValue;
307 }
308
Changed:
protected function doFlexFormOverlay(array &$confArray, $key, $sectionKey = NULL) {
$flexValue = NULL;
$flexKey = 'mm' . ucfirst($key);
if ($sectionKey === NULL) {
if (is_array($confArray['parameter.']))
$flexValue = $confArray['parameter.'][$flexKey];
} else {
if (is_array($confArray['parameter.']) && is_array($flexValue = $confArray['parameter.'][$flexKey]))
$flexValue = $confArray['parameter.'][$flexKey][$sectionKey];
}
if ($flexValue === NULL) {
$flexValue = isset($confArray[$key . '.']) ? $this->cObj->stdWrap($confArray[$key], $confArray[$key . '.']) : $confArray[$key];
}
return $flexValue;
}