I am still learning PHP and was wondering so don't shoot me down and was wondering why I would get the following error message?
2020-02-01 16:11:14 Error: [InvalidArgumentException] Invalid data type, must be an array or \ArrayAccess instance.
Request URL: /auth/signin
Referer URL: https://urlsize.com/auth/signup
Which then returns "Error: An Internal Error Has Occurred." to the user.
The code which I believe is at fault is:
public function signin()
{
if ($this->Auth->user('id')) {
return $this->redirect('/');
}
$user = $this->Users->newEntity();
$this->set('user', $user);
if ($this->request->is('post') || $this->request->query('provider')) {
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
$_SESSION['Auth']['domains_auth'] = 'none';
$multi_domains = get_all_multi_domains_list();
$main_domain = get_option('main_domain', '');
unset($multi_domains[$main_domain]);
if (count($multi_domains)) {
$_SESSION['Auth']['User']['domains_auth'] = 'required';
}
if (version_compare(get_option('app_version', '1.0.0'), '2.0.0', '<')) {
$user['role'] = 2;
if ($user['account_type'] == 'Admin') {
$user['role'] = 1;
}
}
if ($user['role'] == 1) {
return $this->redirect([
'plugin' => false,
'controller' => 'Users',
'action' => 'dashboard',
'prefix' => 'admin'
]);
}
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error(__('Invalid username or password, try again'));
}
}
Your help would be great.