From 9dc8476f5d469fd0d5cb6814b86f67f87e1d90e3 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 31 Jan 2021 01:43:07 +0900 Subject: [PATCH] Set $output->data to NULL if query returns no rows --- common/framework/db.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/framework/db.php b/common/framework/db.php index f5662a6fe..4002c4fc5 100644 --- a/common/framework/db.php +++ b/common/framework/db.php @@ -538,9 +538,9 @@ class DB throw new Exceptions\DBError($e->getMessage(), 0, $e); } - if ($result_type === 'auto' && $last_index === 0 && count($result) === 1) + if ($result_type === 'auto' && $last_index === 0 && count($result) <= 1) { - return $result[0]; + return isset($result[0]) ? $result[0] : null; } else {