Zend Framework Login: Fatal error Cannot use object of type stdClass as array


Zend Framework Login System Step by Step Tutorial - Part 4: We run previous post, I get error message like this: Fatal error: Cannot use object of type stdClass as array in C:\AppServ5\www\test\zend\helloworld\ library\Zend\Auth\Adapter\DbTable.php on line 340. If you are same like me, let's fix this problem. Skip this post if you don't fine any error at previous post.

Sadly, I still didn't have much time to know about this error when I was writing this post. So, I decide to fix at core of Zend library. I will tell you latter if I find fixing this error more better than this post.

Ok, open DbTable.php within library\Zend\Auth\Adapter\. Update line 340:

Before:

if ($resultIdentity['zend_auth_credential_match'] != '1') {

Become:

if ($resultIdentity->zend_auth_credential_match != '1') {

Then, update line 346:

unset($resultIdentity['zend_auth_credential_match']);

Become:

unset($resultIdentity->zend_auth_credential_match);

I will update this post if there is more better than this way. Do you want to share idea?



Series this article:
Zend Framework Login: Preparing Database
Zend Framework Login: Creating Form Login
Zend Framework Login: Creating Authentication
Zend Framework Login: Fatal error Cannot use object of type stdClass as array
Zend Framework Login: Protected Page
Zend Framework Login: Creating Logout
Zend Framework Login: Creating Switching for Front Page

Bookmark and Share Tag: framework, zend, zend framework, authentication, Zend_Auth, error, stdClass, array Category: PHP Framework Post : April 22nd 2008 Read: 41,410

advertisements


blog comments powered by Disqus