From 6eca693dcde6083d701aa55dbed21d55b3b6f2f8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 19 Jul 2016 14:50:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84autoCo?= =?UTF-8?q?mpleteData=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index 47d422e5..16db8797 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -756,7 +756,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $value = null; } if (!in_array($field, $this->change)) { - $this->setAttr($field, isset($this->data[$field]) ? $this->data[$field] : $value); + $this->setAttr($field, !is_null($value) ? $value : (isset($this->data[$field]) ? $this->data[$field] : $value)); } } }