zunxunz Posted July 2 Share Posted July 2 It seems to me that in this situation the shop should stay alive, but just not cache data. The function Memcached->connect() (see below) causes a fatal PHP error: Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /data/html/protempo.nu/classes/cache/CacheMemcached.php on line 84. $this->memcached->getVersion() does not return an array when the memcached service is not running, hence the Fatal error. public function connect() { if (class_exists('Memcached') && extension_loaded('memcached')) { $this->memcached = new Memcached(); } else { return; } $servers = self::getMemcachedServers(); if (!$servers) { return; } foreach ($servers as $server) { $this->memcached->addServer($server['ip'], $server['port'], (int) $server['weight']); } $this->is_connected = in_array('255.255.255', $this->memcached->getVersion(), true) === false; } Link to comment Share on other sites More sharing options...
Knowband Plugins Posted July 2 Share Posted July 2 17 minutes ago, zunxunz said: $this->is_connected = in_array('255.255.255', $this->memcached->getVersion(), true) === false; Override the class and change to the above line to below, if $this->memcached->getVersion() does not return anything, is not connected. $memcached_versions = $this->memcached->getVersion() ? $this->memcached->getVersion() : array(); $this->is_connected = in_array('255.255.255', $memcached_versions, true) === false; 1 Link to comment Share on other sites More sharing options...
zunxunz Posted August 12 Author Share Posted August 12 (edited) On 7/2/2025 at 1:51 PM, Knowband Plugins said: Override the class and change to the above line to below, if $this->memcached->getVersion() does not return anything, is not connected. $memcached_versions = $this->memcached->getVersion() ? $this->memcached->getVersion() : array(); $this->is_connected = in_array('255.255.255', $memcached_versions, true) === false; This is a bug report, the issue should be addressed and fixed in the core code, not by implementing an override (which is discouraged by Prestashop) in my own shop. Edited August 12 by zunxunz (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now