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

$_COOKIE['waconcookiemanagement'] should be an empty string, not null, when not defined #79

Open instruccionesaldorso opened 9 months ago

instruccionesaldorso commented 9 months ago

We had a running TYPO3 11.5.33 instance, where we installed EXT:wacon_cookie_management version 3.3.1. We were forced at that point to apply a patch for this line: https://github.com/wacon-internet-gmbh/wacon_cookie_management/blob/3.3.1/Classes/Controller/CookieController.php#L149

-        $cookie = $_COOKIE['waconcookiemanagement'];
+        $cookie = $_COOKIE['waconcookiemanagement'] ?? '';

Now that we decided to upgrade the extension to latest version 4.0.1, this error still persists if a similar patch is not applied.

Line https://github.com/wacon-internet-gmbh/wacon_cookie_management/blob/4.0.1/Classes/Controller/CookieController.php#L207 is now changed to:

$cookie = $_COOKIE['waconcookiemanagement'] ?? null;; 

This produces this error:

PHP Runtime Deprecation Notice: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/public/typo3conf/ext/wacon_cookie_management/Classes/Controller/CookieController.php line 216

as the haystack for strpos() function cannot be null, and it needs to be an empty string.

https://github.com/wacon-internet-gmbh/wacon_cookie_management/blob/4.0.1/Classes/Controller/CookieController.php#L216

Could this error be fixed?

Notice also the double semicolon ;; at the end of the line (one can be removed)

PKuhlmay commented 8 months ago

Fixed via https://github.com/wacon-internet-gmbh/wacon_cookie_management/commit/36b6ee5c8d8b8fa9c8b30ec95d8b195c0123f540

PKuhlmay commented 8 months ago

Hi @instruccionesaldorso Could you please check this again? It is now an empty string, instead of null. This is only available in the master branch at the moment. The changes are not tagged with a new version.