From 2b0bfa8e8bc560fae81a295542c27b35a62bacbc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 24 Apr 2017 16:11:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E6=98=AF=5F=5F?= =?UTF-8?q?unset=E5=92=8C=5F=5Fisset=E6=96=B9=E6=B3=95=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 71186b91..1f747753 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1975,7 +1975,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess public function __isset($name) { try { - if (array_key_exists($name, $this->data)) { + if (array_key_exists($name, $this->data) || array_key_exists($name, $this->relation)) { return true; } else { $this->getAttr($name); @@ -1995,7 +1995,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess */ public function __unset($name) { - unset($this->data[$name]); + unset($this->data[$name], $this->relation[$name]); } public function __toString()