From 69fc7cd6bc7fb43aee887756628206263fe495b6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 1 Mar 2018 19:28:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A8=A1=E5=9E=8B=E7=B1=BBre?= =?UTF-8?q?adTransform=E6=96=B9=E6=B3=95=E5=AF=B9=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=A4=84=E7=90=86?= 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 a42eafaf..cbab7155 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -679,7 +679,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $value = empty($value) ? new \stdClass() : json_decode($value); break; case 'serialize': - $value = unserialize($value); + try { + $value = unserialize($value); + } catch (\Exception $e) { + $value = null; + } break; default: if (false !== strpos($type, '\\')) {