From 4ce078940b70b63dc2e61ec299e23228d4e14fe4 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 28 Nov 2024 17:16:50 +0800 Subject: [PATCH] * [refac] filter empty value. --- lib/base/mao/mao.class.php | 2 +- lib/cache/cache.class.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/base/mao/mao.class.php b/lib/base/mao/mao.class.php index 57432b446a..b4fedca37a 100644 --- a/lib/base/mao/mao.class.php +++ b/lib/base/mao/mao.class.php @@ -565,7 +565,7 @@ class baseMao if(is_string($value)) $value = explode(',', str_replace(' ', '', $value)); if(is_array($value)) { - $rawResult = $this->cache->fetchAll($this->table, $value); + $rawResult = $this->cache->fetchAll($this->table, array_filter($value)); break; } } diff --git a/lib/cache/cache.class.php b/lib/cache/cache.class.php index 4c5cff6da0..40d00465b4 100644 --- a/lib/cache/cache.class.php +++ b/lib/cache/cache.class.php @@ -653,7 +653,11 @@ class cache if(empty($objectIdList)) $objectIdList = $allObjectIdList; $keys = []; - foreach($objectIdList as $objectID) $keys[$objectID] = $this->getRawCacheKey($code, $objectID); + foreach($objectIdList as $objectID) + { + if(!$objectID) continue; + $keys[$objectID] = $this->getRawCacheKey($code, $objectID); + } $objects = $this->cache->getMultiple(array_values($keys));