Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use object of type stdClass as array #13

Closed
LorenzBischof opened this issue Mar 24, 2015 · 3 comments
Closed

Cannot use object of type stdClass as array #13

LorenzBischof opened this issue Mar 24, 2015 · 3 comments
Assignees
Labels

Comments

@LorenzBischof
Copy link

Hello,

I am receiving following error:

127.0.0.1:52605 [200]: /login - Cannot use object of type stdClass as array in /.../vendor/jeremykendall/slim-auth/src/JeremyKendall/Slim/Auth/Adapter/Db/PdoAdapter.php on line 90

I am using following code:

$adapter = new PdoAdapter(
    $db, 
    'Students', 
    'email', 
    'password', 
    new PasswordValidator()
);

$acl = new \Mini\Acl();
$authBootstrap = new Bootstrap($app, $adapter, $acl);
$authBootstrap->bootstrap();
$app->add(new \Slim\Middleware\SessionCookie());

I also added the cookies config and example route. Am I doing something wrong?

@jeremykendall
Copy link
Owner

It seems you have \PDO::ATTR_DEFAULT_FETCH_MODE set to \PDO::FETCH_OBJ rather than \PDO::FETCH_ASSOC (or one of the other fetch modes that includes an associative array).

A quick fix for you might be to choose \PDO::FETCH_LAZY for now, but this is definitely an oversight on my part. I need to set a fetch mode in the PdoAdapter.

Thanks for the bug report.

@LorenzBischof
Copy link
Author

Thank you very much!

@jeremykendall
Copy link
Owner

@LorenzBI You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants