From f3aa05f8081571bfb733a7347085f088b0d81acb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 30 Apr 2017 21:45:09 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=94=B9=E8=BF=9BRequest=E7=B1=BBfilterV?= =?UTF-8?q?alue=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/Request.php b/library/think/Request.php index 1eb7f297..803a5240 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1060,7 +1060,7 @@ class Request // 调用函数或者方法过滤 $value = call_user_func($filter, $value); } elseif (is_scalar($value)) { - if (strpos($filter, '/')) { + if (false !== strpos($filter, '/')) { // 正则过滤 if (!preg_match($filter, $value)) { // 匹配不成功返回默认值 From 68790e8d9a6b4075b16f15e1bd419492e95fe0ec Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 30 Apr 2017 22:58:49 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/library/think/Request.php b/library/think/Request.php index 803a5240..c4dad8b7 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1034,11 +1034,7 @@ class Request $filter = []; } else { $filter = $filter ?: $this->filter; - if (is_string($filter)) { - $filter = explode(',', $filter); - } else { - $filter = (array) $filter; - } + $filter = (array) $filter; } $filter[] = $default; From f1b3ab5a3dbceb9292ed6d9ca34cd80cb57c0664 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 3 May 2017 11:22:08 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=94=B9=E8=BF=9BRequest=E7=B1=BB?= =?UTF-8?q?=E7=9A=84filter=E8=BF=87=E6=BB=A4=E6=9C=BA=E5=88=B6=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=AD=A3=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/think/Request.php b/library/think/Request.php index c4dad8b7..583dfb84 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1034,7 +1034,11 @@ class Request $filter = []; } else { $filter = $filter ?: $this->filter; - $filter = (array) $filter; + if (is_string($filter) && false === strpos($filter, '/')) { + $filter = explode(',', $filter); + } else { + $filter = (array) $filter; + } } $filter[] = $default; From 2c60d4a13bdbdd9b24fe72fb70aceec607a7001d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 3 May 2017 15:23:45 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=94=B9=E8=BF=9Bmysql=E9=87=8D=E8=BF=9E?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/connector/Mysql.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/db/connector/Mysql.php b/library/think/db/connector/Mysql.php index 0081fb2e..4b6e11a2 100644 --- a/library/think/db/connector/Mysql.php +++ b/library/think/db/connector/Mysql.php @@ -138,8 +138,13 @@ class Mysql extends Connection */ protected function isBreak($e) { - if (false !== stripos($e->getMessage(), 'server has gone away')) { - return true; + $info = ['server has gone away', 'Error while sending STMT_']; + $error = $e->getMessage(); + + foreach ($info as $msg) { + if (false !== stripos($error, $msg)) { + return true; + } } return false; } From 7dc2a9d9750e107e36a9b74517951551ad13620e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 3 May 2017 15:37:35 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E6=94=B9=E8=BF=9BisBreak=E6=96=B9?= =?UTF-8?q?=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/db/Connection.php | 22 +++++++++++++++++++++- library/think/db/connector/Mysql.php | 18 ------------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index d2aa6ea9..908384cb 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -780,11 +780,31 @@ abstract class Connection /** * 是否断线 * @access protected - * @param \PDOException $e 异常 + * @param \PDOException $e 异常对象 * @return bool */ protected function isBreak($e) { + $info = [ + 'server has gone away', + 'no connection to the server', + 'Lost connection', + 'is dead or not enabled', + 'Error while sending', + 'decryption failed or bad record mac', + 'server closed the connection unexpectedly', + 'SSL connection has been closed unexpectedly', + 'Error writing data to the connection', + 'Resource deadlock avoided', + ]; + + $error = $e->getMessage(); + + foreach ($info as $msg) { + if (false !== stripos($error, $msg)) { + return true; + } + } return false; } diff --git a/library/think/db/connector/Mysql.php b/library/think/db/connector/Mysql.php index 4b6e11a2..dc717532 100644 --- a/library/think/db/connector/Mysql.php +++ b/library/think/db/connector/Mysql.php @@ -130,22 +130,4 @@ class Mysql extends Connection return true; } - /** - * 是否断线 - * @access protected - * @param \PDOException $e 异常对象 - * @return bool - */ - protected function isBreak($e) - { - $info = ['server has gone away', 'Error while sending STMT_']; - $error = $e->getMessage(); - - foreach ($info as $msg) { - if (false !== stripos($error, $msg)) { - return true; - } - } - return false; - } } From aa0198a47c735d21c1e874f7d2729fadbeb0b704 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 3 May 2017 18:13:38 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tpl/think_exception.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/think_exception.tpl b/tpl/think_exception.tpl index 2d898c30..0c9d31ed 100644 --- a/tpl/think_exception.tpl +++ b/tpl/think_exception.tpl @@ -79,7 +79,7 @@ - <?php echo lang('System Error'); ?> + <?php echo \think\Lang::get('System Error'); ?>