disable memmcached in php 8

This commit is contained in:
Sebijk 2022-12-10 00:08:09 +01:00
parent 5b8e138bfd
commit 361ea6b0b9
2 changed files with 13 additions and 2 deletions

View file

@ -192,7 +192,12 @@ else if($_REQUEST['action'] == 'caching')
// assign
$bm_prefs['memcache_servers'] = str_replace(';', "\n", $bm_prefs['memcache_servers']);
$tpl->assign('memcache', class_exists('Memcache') || class_exists('Memcached'));
if((int)str_replace('.', '', phpversion()) >= 800) { // In PHP 8 we will disable memcached
$tpl->assign('memcache', false);
}
else {
$tpl->assign('memcache', class_exists('Memcache') || class_exists('Memcached'));
}
$tpl->assign('page', 'prefs.caching.tpl');
}

View file

@ -353,7 +353,13 @@ class BMCache_memcache extends BMCache
$memcacheServers = explode(';', $bm_prefs['memcache_servers']);
if(class_exists('Memcache') || class_exists('Memcached'))
{
if(count($memcacheServers) > 0 && trim($memcacheServers[0]) != '')
if((int)str_replace('.', '', phpversion()) >= 800) { // In PHP 8 we will disable memcached
PutLog('PHP 8 or higher detected. memcache is disabled. Please choose an other cache method or contribute your code changes to the community.',
PRIO_WARNING,
__FILE__,
__LINE__);
}
else if(count($memcacheServers) > 0 && trim($memcacheServers[0]) != '')
{
if(class_exists('Memcache'))
{