From e3b9caab23ffd6df0f6af12ceede5293e9fc08b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 22 Feb 2021 10:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Base/BaseActiveRecord.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 814a4a2f..b8d405fb 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -228,8 +228,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess * @throws ReflectionException * @throws Exception */ - public static function findOne($param, $db = NULL): static + public static function findOne($param, $db = NULL): static|null { + if (is_bool($param)) { + return null; + } if (is_numeric($param)) { $primary = static::getColumns()->getPrimaryKeys(); if (empty($primary)) {