Set $output->data to NULL if query returns no rows

This commit is contained in:
Kijin Sung 2021-01-31 01:43:07 +09:00
parent 800f323b9c
commit 9dc8476f5d

View file

@ -538,9 +538,9 @@ class DB
throw new Exceptions\DBError($e->getMessage(), 0, $e); 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 else
{ {