From 08c3be7c4c31d779dfbeaae351715cfaa3190dff Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 14 Dec 2016 15:08:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=BF=BD=E5=8A=A0=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=A8=A1=E5=9E=8B=E5=B1=9E=E6=80=A7=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index 7e00d60a..1d34a366 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -516,7 +516,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess if ($model instanceof Model) { foreach ($append as $key => $attr) { $key = is_numeric($key) ? $attr : $key; - $this->setAttr($key, $model->$attr); + if ($this->__isset($key)) { + throw new Exception('bind attr has exists:' . $key); + } else { + $this->setAttr($key, $model->$attr); + } } } return $this;