From dcb46092d1f3a12498a7469b27c2148e20a63fec Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 20 Feb 2017 11:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index b38778ab..8aa468c1 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -290,9 +290,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } // 标记字段更改 - if (isset($this->data[$name]) && is_scalar($this->data[$name]) && is_scalar($value) && 0 !== strcmp($this->data[$name], $value)) { + if (!isset($this->data[$name])) { $this->change[] = $name; - } elseif (!isset($this->data[$name]) || $value != $this->data[$name]) { + } elseif (is_scalar($value) && is_scalar($this->data[$name]) && 0 !== strcmp($this->data[$name], $value)) { + $this->change[] = $name; + } elseif (!is_object($value) && $value != $this->data[$name]) { $this->change[] = $name; } // 设置数据对象属性