From 12081bb1e3c54d755d1ca00e6aa8d2ed7bd20fd5 Mon Sep 17 00:00:00 2001 From: CantonBolo Date: Thu, 30 Jun 2016 11:44:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3classmap=E4=B8=AD=E9=81=97?= =?UTF-8?q?=E6=BC=8Fthink\debug\Trace=E7=9A=84=E8=B7=AF=E5=BE=84=20(#179)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修正classmap中遗漏think\debug\trace\Html和think\debug\trace\Console的路径 * 修正classmap中遗漏think\debug\Trace的路径 * 判断trace类型类是否存在 --- classmap.php | 3 +++ library/think/debug/Trace.php | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/classmap.php b/classmap.php index 9fe54787..a12636cc 100644 --- a/classmap.php +++ b/classmap.php @@ -56,6 +56,9 @@ return [ 'think\db\builder\Sqlsrv' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Sqlsrv' . EXT, 'think\db\Query' => CORE_PATH . 'db' . DS . 'Query' . EXT, 'think\Debug' => CORE_PATH . 'Debug' . EXT, + 'think\debug\Trace' => CORE_PATH . 'debug' . DS . 'Trace' . EXT, + 'think\debug\trace\Html' => CORE_PATH . 'debug' . DS . 'trace' . DS . 'Html' . EXT, + 'think\debug\trace\Console' => CORE_PATH . 'debug' . DS . 'trace' . DS . 'Console' . EXT, 'think\Error' => CORE_PATH . 'Error' . EXT, 'think\Exception' => CORE_PATH . 'Exception' . EXT, 'think\exception\ClassNotFoundException' => CORE_PATH . 'exception' . DS . 'ClassNotFoundException' . EXT, diff --git a/library/think/debug/Trace.php b/library/think/debug/Trace.php index a626a0c7..f44b0b4f 100644 --- a/library/think/debug/Trace.php +++ b/library/think/debug/Trace.php @@ -11,6 +11,7 @@ namespace think\debug; use think\Config; +use think\exception\ClassNotFoundException; use think\Log; use think\Request; use think\Response; @@ -31,7 +32,11 @@ class Trace $class = false !== strpos($type, '\\') ? $type : '\\think\\debug\\trace\\' . ucwords($type); unset($config['type']); - $trace = new $class($config); + if(class_exists($class)) { + $trace = new $class($config); + } else { + throw new ClassNotFoundException('class not exists:' . $class, $class); + } if ($response instanceof Redirect) { //TODO 记录