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.

It's really difficult for us to debug this based on the information you've provided because it just seems to be a whole bunch of function calls. One of the function calls is for a function that looks like this:

public function name(array $array_name) { ... }

It requires that you call it as such: $object->name($array_name) and it's complaining that what you're passing in (e.g. $array_name) is not actually an array.

However, the code you've provided gives no clue what function wants an array. For example, on line 8, does setUser require an array and $user is not one?? Or on line 8, does set require an array and $user is not one? There's no way of knowing with the information you've provided.

Is there no way in your error logs to see what line the error occurred on? Perhaps overload the error method in your framework so that it spits out the line that errored.

Totally understand what your saying and will try capture the actual line as the current error is simply:

"2020-02-01 16:11:14 Error: [InvalidArgumentException] Invalid data type, must be an array or \ArrayAccess instance.
Request URL: /auth/signin"

PHP and the site error log doesn't show anything with regards to this.