🐛 | Cookies Addons | PHP 8.1+ Deprecation warning: Passing null to json_decode() in _cookies_addons_views_is_restricted()
scontzen → created an issue.
After examining the code more carefully, I've identified the exact cause of the issue and implemented a complete solution.
The problem occurs in cookies_addons_views_preprocess_views_view() where we completely reset the $variables array:
$variables = [];
This operation wipes out all existing values, including the critical theme_hook_original key that Drupal's theme system needs. This is what causes the warning.
My solution preserves and restores this important value:
$theme_hook_original = $variables['theme_hook_original'] ?? '';
$variables['theme_hook_original'] = $theme_hook_original;
This approach:
- Saves the theme hook information before it's lost
- Allows us to still reset the variables array as needed
- Ensures the theme system has the information it needs at render time
Thanks a lot!
scontzen → created an issue.