From 1a2008c538588fc54da4ec488466da5584e8ac6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=A1=E5=AE=85=E7=94=B7=E5=B7=A5=E4=BD=9C=E5=AE=A4?= <530765310@qq.com> Date: Tue, 2 Jul 2024 15:06:36 +0800 Subject: [PATCH] Update XSSearch.class.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit php8.1 strpos不能为null --- lib/XSSearch.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/XSSearch.class.php b/lib/XSSearch.class.php index 74bcd44..a055a05 100644 --- a/lib/XSSearch.class.php +++ b/lib/XSSearch.class.php @@ -946,10 +946,12 @@ private function logQuery($query = null) } else { // 无结果、包含 OR、XOR、NOT/-、默认 fuzzy $query = $this->_query; - if (!$this->_lastCount || ($this->_defaultOp == XS_CMD_QUERY_OP_OR && strpos($query, ' ')) - || strpos($query, ' OR ') || strpos($query, ' NOT ') || strpos($query, ' XOR ')) { - return; - } + if (!$this->_lastCount || ($this->_defaultOp == XS_CMD_QUERY_OP_OR && (null !== $query && strpos($query, ' '))) + || (null !== $query && strpos($query, ' OR ')) + || (null !== $query && strpos($query, ' NOT ')) + || (null !== $query && strpos($query, ' XOR '))) { + return; + } $terms = $this->terms(null, false); } // purify the query statement to log