Skip to content

Incorrect session expiration time while winter/daylight saving time changes #244

@forrest79

Description

@forrest79

Version: 3.3.2

Bug Description

In DI we had set:

session:
    expiration: '+75 minutes' 

During last winter to daylight saving time change, we encounter this error in log PHP User Notice: The expiration time is greater than the session expiration 900 seconds in .../vendor/nette/http/src/Http/SessionSection.php:197.

This error appears at 01:45 (30.3.2025) and the last was at 01:59. Our setting is 75 minutes = 4500 second. Minus one hour, it is 900 seconds (from the error message). The error started 75 minutes before 3:00 and ended at 2:00 when the time was changed to 3:00.

I think the problem is in the vendor/nette/http/src/Http/Session.php -> setExpiration method.

$expire = Nette\Utils\DateTime::from($expire)->format('U') - time()

DateTime is handling correctly time change, but time() doesn't. For now, we try to fix this by setting expiration: '4500' that is in Nette\Utils\DateTime::from() used as numeric and is not converted via PHP DateTime.

Steps To Reproduce

Not sure how to simply simulate this without changing computer date/time.

Expected Behavior

I'm expecting correct expiration time during winter/daylight saving time change.

Possible Solution

Not sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions