From 90b0da7bede6b705a4c53d0e59eab386305e0091 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 7 Dec 2016 15:33:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BBsetAttr?= =?UTF-8?q?=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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index 93953f2c..4176a12d 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -292,7 +292,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } // 标记字段更改 - if (!isset($this->data[$name]) || (0 !== strcmp($this->data[$name], $value) && !in_array($name, $this->change))) { + if (isset($this->data[$name]) && is_scalar($this->data[$name]) && is_scalar($value) && 0 !== strcmp($this->data[$name], $value)) { + $this->change[] = $name; + } elseif (!isset($this->data[$name]) || $value != $this->data[$name]) { $this->change[] = $name; } // 设置数据对象属性