The users on the application are logged in by their e-mail. This e-mail is in a session. With this session I try to get more information of that user to print out there (sur
It is because you are using the $user object as an array (as the error message makes perfectly clear).
$user
Change:
var_dump($user['avatar']);
To this:
var_dump($user->avatar);