我设置了最新的蛋糕ph设置,当我尝试登录用户时,它会给我这个错误
传递给Cake\Http\Session::_overwrite((的参数1必须为数组类型,给定null
我的代码是
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl());
} else {
$this->Flash->error(__('Username or password is incorrect'));
}
当我检查$user时,它会给我已识别的用户,但后来它会给出上面的错误。
在供应商的_overwrite函数中删除Session.php中的数组类型。如下代码所示。这是我的工作。/vendor/cakephp/cakephp/src/Http
protected function _overwrite( &$old, array $new): void{
if (!empty($old)) {
foreach ($old as $key => $var) {
if (!isset($new[$key])) {
unset($old[$key]);
}
}
}
foreach ($new as $key => $var) {
$old[$key] = $var;
}
}