From f6c169d2f8417e149eae65837692cce842087c52 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <machniak@kolabsys.com> Date: Tue, 9 Apr 2019 11:35:43 +0200 Subject: [PATCH] Fix PHP Warning: Use of undefined constant MEMCACHE_COMPRESSED... on PHP 7.3 w/o memcache --- lib/Net/LDAP3.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php index 69d0cc7..badedb5 100644 --- a/lib/Net/LDAP3.php +++ b/lib/Net/LDAP3.php @@ -2985,8 +2985,9 @@ class Net_LDAP3 public function set_cache_data($key, $data, $ttl = 3600) { if ($cache = $this->get_cache()) { - if (!method_exists($cache, 'replace') || !$cache->replace($key, $data, MEMCACHE_COMPRESSED, $ttl)) { - return $cache->set($key, $data, MEMCACHE_COMPRESSED, $ttl); + $flags = defined('MEMCACHE_COMPRESSED') ? MEMCACHE_COMPRESSED : 0; + if (!method_exists($cache, 'replace') || !$cache->replace($key, $data, $flags, $ttl)) { + return $cache->set($key, $data, $flags, $ttl); } else { return true; -- GitLab