wacon-internet-gmbh / wacon_cookie_management

WCM ist eine TYPO3 Extension, die es den Besuchern Ihrer Website erlaubt, die benutzten Cookie-Einstellungen selber zu kontrollieren.
https://www.wacon.de
GNU General Public License v2.0
10 stars 7 forks source link

Avoid php Warnings Uncaught TYPO3 Exception: #1476107295: PHP Warning: Undefined array key "header" in /html/typo3/typo3conf/ext/wacon_cookie_management/Classes/Controller/CookieController.php line 66 #80

Open christophrunkel opened 8 months ago

christophrunkel commented 8 months ago

Bug Report

Controller causes php warnings in PHP 8.2

Current Behavior Undefined array key "header" in /html/typo3/typo3conf/ext/wacon_cookie_management/Classes/Controller/CookieController.php line 66

Environment

Possible Solution

Adding ?? null in line 66 ff fixes the problem.

$header = $this->settings['header'] ?? null; $this->view->assign('header', $header); $teaser = $this->settings['teaser'] ?? null; $this->view->assign('teaser', $teaser); $linktext = $this->settings['linktext'] ?? null; $this->view->assign('linktext', $linktext); $imprint = $this->settings['imprint'] ?? null; $this->view->assign('imprint', $imprint); $dataprotection = $this->settings['dataProtection'] ?? null; $this->view->assign('dataprotection', $dataprotection ); $nurlink = $this->settings['nurLink'] ?? null;

PKuhlmay commented 8 months ago

Solved in https://github.com/wacon-internet-gmbh/wacon_cookie_management/commit/e5fd9ed24f0ef39b54a2cc3566ba1d08199136cb

PKuhlmay commented 8 months ago

Hi @christophrunkel Could you please check this? I set the default value to an empty string instead of null. The default value which is passed into the settings is already an empty string, so this made more sense. It is not published to the TER, if you are not using composer, I could send you a zip via Slack (treupo).