传递给 pluginSplit() 的参数 1 必须是字符串类型,数组给定
Argument 1 passed to pluginSplit() must be of the type string, array given
我目前正在尝试从 3.10.2
迁移到 4.0
。我已经阅读了指南,现在正在尝试解决出现的问题。
我发现这个相当神秘。
Argument 1 passed to pluginSplit() must be of the type string, array given, called in C:\path\to\app\vendor\cakephp\cakephp\src\Core\ObjectRegistry.php on line 300
我怀疑与加载插件有关。我没有在堆栈跟踪中找到对我自己的文件的任何引用:
Error in: ROOT\vendor\cakephp\cakephp\src\Core\functions.php, line 89
pluginSplit
CORE\src\Core\ObjectRegistry.php:300
Cake\Core\ObjectRegistry->normalizeArray
CORE\src\View\View.php:1091
Cake\View\View->loadHelpers
CORE\src\View\View.php:350
Cake\View\View->__construct
CORE\src\View\ViewBuilder.php:556
Cake\View\ViewBuilder->build
CORE\src\View\ViewVarsTrait.php:74
Cake\Controller\Controller->createView
CORE\src\Controller\Controller.php:687
Cake\Controller\Controller->render
CORE\src\Controller\Controller.php:530
Cake\Controller\Controller->invokeAction
CORE\src\Controller\ControllerFactory.php:79
Cake\Controller\ControllerFactory->invoke
CORE\src\Http\BaseApplication.php:229
Cake\Http\BaseApplication->handle
CORE\src\Http\Runner.php:77
Cake\Http\Runner->handle
CORE\src\Http\Runner.php:77
Cake\Http\Runner->handle
CORE\src\Http\Middleware\CsrfProtectionMiddleware.php:128
Cake\Http\Middleware\CsrfProtectionMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Http\Runner.php:58
Cake\Http\Runner->run
CORE\src\Routing\Middleware\RoutingMiddleware.php:166
Cake\Routing\Middleware\RoutingMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Routing\Middleware\AssetMiddleware.php:68
Cake\Routing\Middleware\AssetMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Error\Middleware\ErrorHandlerMiddleware.php:119
Cake\Error\Middleware\ErrorHandlerMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Http\Runner.php:58
Cake\Http\Runner->run
CORE\src\Http\Server.php:90
Cake\Http\Server->run
ROOT\webroot\index.php:40
编辑 #1
第 3 行失败:
$this->loadComponent("WetKit.WetKit");
$this->viewBuilder()->setHelpers(['WetKit.Wet']);
$this->viewBuilder()->setHelpers(['Form', ['templates' => 'WetKit.wet_form']]);
$this->viewBuilder()->setTheme('WetKit');
您为助手定义选项的方式是错误的,它必须定义为数组键的值,而不是单独的数组条目,否则该数组将被传递到解析助手名称的逻辑中,导致您看到的错误。
长话短说:
$this->viewBuilder()->setHelpers([
'Form' => [
'templates' => 'WetKit.wet_form'
],
]);
我觉得缺少一些有关如何 set/add 帮助程序进行配置的文档。您可能想在 GitHub.
上为此打开一个问题
我目前正在尝试从 3.10.2
迁移到 4.0
。我已经阅读了指南,现在正在尝试解决出现的问题。
我发现这个相当神秘。
Argument 1 passed to pluginSplit() must be of the type string, array given, called in C:\path\to\app\vendor\cakephp\cakephp\src\Core\ObjectRegistry.php on line 300
我怀疑与加载插件有关。我没有在堆栈跟踪中找到对我自己的文件的任何引用:
Error in: ROOT\vendor\cakephp\cakephp\src\Core\functions.php, line 89
pluginSplit
CORE\src\Core\ObjectRegistry.php:300
Cake\Core\ObjectRegistry->normalizeArray
CORE\src\View\View.php:1091
Cake\View\View->loadHelpers
CORE\src\View\View.php:350
Cake\View\View->__construct
CORE\src\View\ViewBuilder.php:556
Cake\View\ViewBuilder->build
CORE\src\View\ViewVarsTrait.php:74
Cake\Controller\Controller->createView
CORE\src\Controller\Controller.php:687
Cake\Controller\Controller->render
CORE\src\Controller\Controller.php:530
Cake\Controller\Controller->invokeAction
CORE\src\Controller\ControllerFactory.php:79
Cake\Controller\ControllerFactory->invoke
CORE\src\Http\BaseApplication.php:229
Cake\Http\BaseApplication->handle
CORE\src\Http\Runner.php:77
Cake\Http\Runner->handle
CORE\src\Http\Runner.php:77
Cake\Http\Runner->handle
CORE\src\Http\Middleware\CsrfProtectionMiddleware.php:128
Cake\Http\Middleware\CsrfProtectionMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Http\Runner.php:58
Cake\Http\Runner->run
CORE\src\Routing\Middleware\RoutingMiddleware.php:166
Cake\Routing\Middleware\RoutingMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Routing\Middleware\AssetMiddleware.php:68
Cake\Routing\Middleware\AssetMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Error\Middleware\ErrorHandlerMiddleware.php:119
Cake\Error\Middleware\ErrorHandlerMiddleware->process
CORE\src\Http\Runner.php:73
Cake\Http\Runner->handle
CORE\src\Http\Runner.php:58
Cake\Http\Runner->run
CORE\src\Http\Server.php:90
Cake\Http\Server->run
ROOT\webroot\index.php:40
编辑 #1
第 3 行失败:
$this->loadComponent("WetKit.WetKit");
$this->viewBuilder()->setHelpers(['WetKit.Wet']);
$this->viewBuilder()->setHelpers(['Form', ['templates' => 'WetKit.wet_form']]);
$this->viewBuilder()->setTheme('WetKit');
您为助手定义选项的方式是错误的,它必须定义为数组键的值,而不是单独的数组条目,否则该数组将被传递到解析助手名称的逻辑中,导致您看到的错误。
长话短说:
$this->viewBuilder()->setHelpers([
'Form' => [
'templates' => 'WetKit.wet_form'
],
]);
我觉得缺少一些有关如何 set/add 帮助程序进行配置的文档。您可能想在 GitHub.
上为此打开一个问题