diff --git a/src/think/route/Dispatch.php b/src/think/route/Dispatch.php index bde9889725..2afdc55355 100644 --- a/src/think/route/Dispatch.php +++ b/src/think/route/Dispatch.php @@ -185,7 +185,9 @@ protected function registerControllerMiddleware($controller): void if ($class->hasProperty('middleware')) { $reflectionProperty = $class->getProperty('middleware'); - $reflectionProperty->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $reflectionProperty->setAccessible(true); + } $middlewares = $reflectionProperty->getValue($controller); $action = $this->request->action(true);