/*
When using Zend_Session_SaveHandler_DbTable, it's important to
create a connection to the database after creating
an instance of the adapter class. Otherwise, if there's a problem with the
connection, you get a Fatal error: Exception thrown without a stack frame
in Unknown on line 0, when catching the exception.
Problem:
*/
try {
$db = Zend_Db::factory('Pdo_Mysql', $config->db);
$adapter = new Zend_Session_SaveHandler_DbTable($config->session);
Zend_Session::setSaveHandler($adapter);
Zend_Session::start();
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
/* Workaround: */
try {
$db = Zend_Db::factory('Pdo_Mysql', $config->db);
$db->getConnection();
$adapter = new Zend_Session_SaveHandler_DbTable($config->session);
Zend_Session::setSaveHandler($adapter);
Zend_Session::start();
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
/* [#ZF-7171] http://framework.zend.com/issues/browse/ZF-7171 */