From f1fda82b0e16f9c3a358d6497e9146215af69d55 Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 22 Nov 2024 13:06:00 +0800 Subject: [PATCH] * [refac] check if a variable is empty before using it as an array. --- lib/cache/cache.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cache/cache.class.php b/lib/cache/cache.class.php index 8aeea8791f..4c5cff6da0 100644 --- a/lib/cache/cache.class.php +++ b/lib/cache/cache.class.php @@ -432,7 +432,7 @@ class cache /* 把被删除的数据的 id 从缓存中删除。Delete the id of the deleted data from cache. */ $setCacheKey = $this->getSetCacheKey($code); $objectIdList = $this->cache->get($setCacheKey); - $this->cache->set($setCacheKey, array_diff($objectIdList, array_map(function($object) use ($field) { return $object->$field; }, $this->objects))); + if($objectIdList) $this->cache->set($setCacheKey, array_diff($objectIdList, array_map(function($object) use ($field) { return $object->$field; }, $this->objects))); if(empty($this->config->cache->res[$this->table])) return;