From 6b4f999bc4d444ece70e0eb3600a3ec7aab3cd20 Mon Sep 17 00:00:00 2001 From: AaronLiu Date: Sat, 22 Dec 2018 12:19:56 +0800 Subject: [PATCH] fix: route checking --- thinkphp/library/think/App.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thinkphp/library/think/App.php b/thinkphp/library/think/App.php index b7d59691..07c09816 100644 --- a/thinkphp/library/think/App.php +++ b/thinkphp/library/think/App.php @@ -551,6 +551,9 @@ class App if (is_file(CONF_PATH . $file . CONF_EXT)) { // 导入路由配置 $rules = include CONF_PATH . $file . CONF_EXT; + if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) { + throw new HttpException(404, 'controller not exists:' . $controller); + } if (is_array($rules)) { Route::import($rules); }