Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
session long expiration time
  • I would like that, when in development mode, to have
    sessions never expire (or at least not expire for a
    very long time). Toward this end, I've added this file:

      fuel/app/config/development/session.php

    with the code:
    -------------------
    <?php
    return array (
      'expiration_time' => -1,
    );
    -------------------

    It has the expected behavior if I set the time value
    to something like "5", expiring after 5 seconds. But
    I'm not sure what to put in there to get it to "never" expire,
    of if I need something else.

    The "-1" value has some effect, but in my test it expired
    within one hour.

    My computer, Php and FuelPhp all use the "America/New_York"
    timezone.

    Thanks.


  • HarroHarro
    Accepted Answer
    The docs define the "expiration_time" config value as:

    Number of seconds of idle time after which the session will expire. This value must be greater than zero. If an invalid value is defined, it will be set to 7200 seconds.

    So according to this, -1 is an illegal value, and will be rejected. However, if you look at the code:

    case 'expiration_time':
        // make sure it's an integer
        $item = (int) $item;
        // invalid? set it to two years from now
        $item <= 0 and $item = 86400 * 365 * 2;

    it suggests that a -1 value sets the expiration time to two years.

    You can use

    \Session::instance()->get_config('expiration_time')

    to verify the value the driver is using.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion