views:

86

answers:

1

I have created Zend_Auth adapter implementing Zend_Auth_Adapter_Interface (similar to Pádraic's adapter) and created simple ACL plugin. Everything works fine with default session handler. So far, so good.

As a next step I have created custom Session SaveHandler to persist session data in the database. My implementation is very similar to this one from parables-demo. Seems that everything is working fine. Session data are properly saved to the database, session objects are serialized, but authentication does not work when I enable this custom SaveHandler.

I have debugged the authentication and all works fine up till the next request, when the authentication data are lost.

I suspected, that is has something to do with the fact, that I use $adapter->write($object) instead $adapter->write($string), but the same happens with strings.

I'm bootstrapping Zend_Application_Resource_Session in the first Bootstrap method, as early as possible.

Does Zend_Auth need any extra configuration to persist data in the database?
Why the authentity is being lost?

A: 

I have found the cause of the problems.

I used 'data' as a column name. Session SaveHandler from parables-demo was calling code similar to this:

$string = 'test'
$doctrineModel->data  =  $string;
echo gettype($doctrineModel->data); // displays 'Array', not string as some would expect

So the data I wanted to save were accidentally converted to arrays.

takeshin