ZF-10700: ( Zend framework 1.11.0 ) Zend_Session_SaveHandler_DbTable, function gc($maxlifetime) issue

Issue Type: Bug Created: 2010-11-17T09:58:56.000+0000 Last Updated: 2010-11-17T10:24:04.000+0000 Status: Resolved Fix version(s): Reporter: phicheth kijtaow (asiansexynine) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Session

Related issues: Attachments:



line 387-394

public function gc($maxlifetime) { $this->delete($this->getAdapter()->quoteIdentifier($this->_modifiedColumn) . ' + ' . $this->getAdapter()->quoteIdentifier($this->_lifetimeColumn) . ' < ' . $this->getAdapter()->quote(time()));

    return true;

my setting

$SessConfig = array( 'save_path' => ROOT. 'temp/sessions', 'name' => 'TestSession', 'cookie_lifetime' => '0', 'gc_maxlifetime' => '300' );


$config = array( 'name' => 'session', //table name as per Zend_Db_Table 'primary' => 'session_id', //session name 'modifiedColumn' => 'modified', //time the session should expire 'dataColumn' => 'data', //serialized data 'lifetimeColumn' => 'lifetime' //end of life for a specific record );

//Tell Zend_Session to use your Save Handler Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));

//start your session Zend_Session::start();

Zend framework 1.11.0

the function gc=garbage collector doesn't work! from my setting is gc_maxlifetime = 300 and SessionID record are not active or close browser over 300 second must been deleted by gc function.

but in my DB Session still keep all inactive session and never deleted any session that expired.

anyway, Create new session and update session are wok fine! but never deleted session..

any idea to fixed this issue or anyone can help, please?

PS : I was check code DbTable.php of ZF2 dev.. but code are same. maybe this issue will not been fixed?


Posted by Matthew Weier O'Phinney (matthew) on 2010-11-17T10:23:49.000+0000

gc() is called by PHP's ext/session, based on a variety of php.ini settings, in particular the "session.gc_*" settings.

That said, in my experience, it's not good to rely on these, and instead to have cron jobs (or similar) that run periodically to call gc() manually.

In closing, this is not a ZF issue, but one with the underlying session extension in PHP.

Have you found an issue?

See the Overview section for more details.


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

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