From fca23afd60213fb74720a672be4683fe672778b6 Mon Sep 17 00:00:00 2001 From: georce <270280739@qq.com> Date: Thu, 10 Oct 2024 11:26:40 +0800 Subject: [PATCH] CVE-2022-25481 --- src/think/exception/Handle.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/think/exception/Handle.php b/src/think/exception/Handle.php index 133918325e..ddc9b72378 100644 --- a/src/think/exception/Handle.php +++ b/src/think/exception/Handle.php @@ -213,20 +213,24 @@ protected function getDebugMsg(Throwable $exception): array ]; } while ($nextException = $nextException->getPrevious()); - return [ + $data = [ 'code' => $this->getCode($exception), 'message' => $this->getMessage($exception), 'traces' => $traces, 'datas' => $this->getExtendData($exception), - 'tables' => [ + ]; + if($this->app->config->get('app.show_env_msg')){ + $data['tables'] = [ 'GET Data' => $this->app->request->get(), 'POST Data' => $this->app->request->post(), 'Files' => $this->app->request->file(), 'Cookies' => $this->app->request->cookie(), 'Session' => $this->app->exists('session') ? $this->app->session->all() : [], 'Server/Request Data' => $this->app->request->server(), - ], - ]; + ]; + } + + return $data; } protected function isJson(Request $request, Throwable $exception)