From 46ce08b962467eca8150bcf4326a9c5960958680 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 27 May 2016 11:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E5=8F=82=E6=95=B0=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BD=BF=E7=94=A8Request=E5=AF=B9=E8=B1=A1=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E4=BC=A0=E5=85=A5=E5=BD=93=E5=89=8D=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 4 +++- library/think/Input.php | 2 +- library/think/Route.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index a6205ff8..9d545d8f 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -194,7 +194,9 @@ class App $params = $reflect->getParameters(); foreach ($params as $param) { $name = $param->getName(); - if (1 == $type && !empty($vars)) { + if ('think\Request' == $param->getClass()->name) { + $args[] = Request::instance(); + } elseif (1 == $type && !empty($vars)) { $args[] = array_shift($vars); } elseif (0 == $type && isset($vars[$name])) { $args[] = $vars[$name]; diff --git a/library/think/Input.php b/library/think/Input.php index a6445b2d..834bd5f0 100644 --- a/library/think/Input.php +++ b/library/think/Input.php @@ -342,7 +342,7 @@ class Input // TODO 其他安全过滤 // 过滤查询特殊字符 - if (preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) { + if (is_string($value) && preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) { $value .= ' '; } } diff --git a/library/think/Route.php b/library/think/Route.php index 5d3badce..ebad2f9b 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -28,8 +28,8 @@ class Route private static $rest = [ 'index' => ['GET', '', 'index'], 'create' => ['GET', '/create', 'create'], - 'read' => ['GET', '/:id', 'read'], 'edit' => ['GET', '/:id/edit', 'edit'], + 'read' => ['GET', '/:id', 'read'], 'save' => ['POST', '', 'save'], 'update' => ['PUT', '/:id', 'update'], 'delete' => ['DELETE', '/:id', 'delete'],