From 2106cdceaf1824333dd958a0e082aa64dbd8e5b7 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 22 May 2016 15:38:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BResponse=E7=B1=BB=E7=9A=84sen?= =?UTF-8?q?d=E6=96=B9=E6=B3=95=20=E6=94=B9=E8=BF=9BInput=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Input.php | 6 +++++- library/think/Response.php | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/library/think/Input.php b/library/think/Input.php index 848be817..a6445b2d 100644 --- a/library/think/Input.php +++ b/library/think/Input.php @@ -465,7 +465,11 @@ class Input // 字符串 case 's': default: - $data = (string) $data; + if (is_scalar($data)) { + $data = (string) $data; + } else { + throw new Exception('变量类型不允许:' . gettype($data)); + } } } } diff --git a/library/think/Response.php b/library/think/Response.php index 634a2d99..8c35f87b 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -111,7 +111,12 @@ class Response header($name . ':' . $val); } } - echo $data; + if (is_scalar($data)) { + echo $data; + } else { + throw new Exception('不支持的数据类型输出:' . gettype($data)); + } + if (function_exists('fastcgi_finish_request')) { // 提高页面响应 fastcgi_finish_request();