10

Is there a way in Zend Framework or PHP to get the time until the Session(PHPSESSID cookie) expires?

Raj
  • 22,346
  • 14
  • 99
  • 142
fsteinbauer
  • 161
  • 1
  • 1
  • 13

1 Answers1

16

I don't know of any method provided by the framework to achieve this. But as soon as you know where ZF stores expiration time for its namespaces, you might be able to do something like this:

$session = new Zend_Session_Namespace( 'Zend_Auth' );
$session->setExpirationSeconds( 60 );

$timeLeftTillSessionExpires = $_SESSION['__ZF']['Zend_Auth']['ENT'] - time();
Vika
  • 3,275
  • 18
  • 16
  • Well i guess it should be `$_SESSION['__ZF']['Zend_Auth']['ENVT'] - time();` But still, thanks for your help!! Wouldn't have made it without your ;) – fsteinbauer Mar 06 '11 at 21:22