[ create a new paste ] login | about

Project: fedecarg
Link: http://fedecarg.codepad.org/5d2ckt3c    [ raw code | fork ]

fedecarg - Plain Text, pasted on Jul 1:
/*
  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 */



Create a new paste based on this one


Comments: