Fatal: Undefined constant SiteGround_Optimizer\File_Cacher\COOKIEHASH
-
In a WordPress MultiSite Network, running PHP 8.0, and with SiteGround Optimizer configured to use File-Based Caching I was able to reproduce a problem I’d recently encountered in the WP-admin page for one of my plugins, and which has previously been reported in this forum.
Where I was getting
Warning: Use of undefined constant COOKIEHASH - assumed 'COOKIEHASH' (this will throw an Error in a future version of PHP) in /home/customer/www/bobbingwide.com/public_html/wp-content/plugins/sg-cachepress/core/File_Cacher/File_Cacher.php on line 785
the error in my local environment is
Fatal error: Uncaught Error: Undefined constant “SiteGround_Optimizer\File_Cacher\COOKIEHASH” in C:\apache\htdocs\wp55\wp-content\plugins\sg-cachepress\core\File_Cacher\File_Cacher.php:785
The problem occurs because COOKIEHASH has not yet been defined. I resolved this issue locally by adding a call to
wp_cookie_constants()
before creating the $config array and prefixing COOKIEHASH with a backslash, for the namespace issue.My analysis is at https://github.com/bobbingwide/slog/issues/29
- The topic ‘Fatal: Undefined constant SiteGround_Optimizer\File_Cacher\COOKIEHASH’ is closed to new replies.