Issues

ZF-7171: Zend_Session_SaveHandler_DbTable produces a fatal error

Issue Type: Bug Created: 2009-07-01T07:32:36.000+0000 Last Updated: 2009-11-14T02:27:45.000+0000 Status: Closed Fix version(s): Reporter: fc (federico.cargnelutti) Assignee: Ralph Schindler (ralph) Tags: - Zend_Session

Related issues: - ZF-7611

Attachments:

Description

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.

<pre class="highlight">
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());
}

http://fedecarg.codepad.org/5d2ckt3c

Comments

No comments to display

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts