修正setAccessible问题,支持php8.5
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# 临时修复topthink/framework 的问题
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# ThinkPHP 8
|
# ThinkPHP 8
|
||||||
|
|||||||
@@ -191,7 +191,9 @@ class Event
|
|||||||
|
|
||||||
if (empty($prefix) && $reflect->hasProperty('eventPrefix')) {
|
if (empty($prefix) && $reflect->hasProperty('eventPrefix')) {
|
||||||
$reflectProperty = $reflect->getProperty('eventPrefix');
|
$reflectProperty = $reflect->getProperty('eventPrefix');
|
||||||
|
if(PHP_VERSION_ID < 80100) {
|
||||||
$reflectProperty->setAccessible(true);
|
$reflectProperty->setAccessible(true);
|
||||||
|
}
|
||||||
$prefix = $reflectProperty->getValue($observer);
|
$prefix = $reflectProperty->getValue($observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ abstract class Dispatch
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 应用对象
|
* 应用对象
|
||||||
|
*
|
||||||
* @var App
|
* @var App
|
||||||
*/
|
*/
|
||||||
protected $app;
|
protected $app;
|
||||||
@@ -40,6 +41,7 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行路由调度
|
* 执行路由调度
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@@ -76,6 +78,7 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查路由后置操作
|
* 检查路由后置操作
|
||||||
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -116,6 +119,7 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取操作的绑定参数
|
* 获取操作的绑定参数
|
||||||
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -131,8 +135,11 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行中间件调度
|
* 执行中间件调度
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
*
|
||||||
* @param object $controller 控制器实例
|
* @param object $controller 控制器实例
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function responseWithMiddlewarePipeline($instance, $action)
|
protected function responseWithMiddlewarePipeline($instance, $action)
|
||||||
@@ -175,8 +182,11 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用反射机制注册控制器中间件
|
* 使用反射机制注册控制器中间件
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
*
|
||||||
* @param object $controller 控制器实例
|
* @param object $controller 控制器实例
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function registerControllerMiddleware($controller): void
|
protected function registerControllerMiddleware($controller): void
|
||||||
@@ -185,7 +195,9 @@ abstract class Dispatch
|
|||||||
|
|
||||||
if($class->hasProperty('middleware')) {
|
if($class->hasProperty('middleware')) {
|
||||||
$reflectionProperty = $class->getProperty('middleware');
|
$reflectionProperty = $class->getProperty('middleware');
|
||||||
|
if(PHP_VERSION_ID < 80100) {
|
||||||
$reflectionProperty->setAccessible(true);
|
$reflectionProperty->setAccessible(true);
|
||||||
|
}
|
||||||
|
|
||||||
$middlewares = $reflectionProperty->getValue($controller);
|
$middlewares = $reflectionProperty->getValue($controller);
|
||||||
$action = $this->request->action(true);
|
$action = $this->request->action(true);
|
||||||
@@ -229,9 +241,12 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由绑定模型实例
|
* 路由绑定模型实例
|
||||||
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
|
*
|
||||||
* @param array $bindModel 绑定模型
|
* @param array $bindModel 绑定模型
|
||||||
* @param array $matches 路由变量
|
* @param array $matches 路由变量
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function createBindModel(array $bindModel, array $matches): void
|
protected function createBindModel(array $bindModel, array $matches): void
|
||||||
@@ -275,8 +290,11 @@ abstract class Dispatch
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证数据
|
* 验证数据
|
||||||
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
|
*
|
||||||
* @param array $option
|
* @param array $option
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \think\exception\ValidateException
|
* @throws \think\exception\ValidateException
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user