You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If PHP is configured with a non-UTC timezone, this library ends up caching objects that should not be cached when going from summer time to winter time.
returnnewCacheEntry($request, $response, new \DateTime('-1 seconds'));
If PHP is configured with a non-UTC time zone, this breaks when going from summer time to winter time.
For example, both UTC time "2024-10-27 00:00:56" and "2024-10-27 01:00:56" was "2024-10-27 02:00:56" in timezone Europe/Berlin:
$ TZ=Europe/Berlin date -d '2024-10-27T00:00:56 +00:00'Sun 27 Oct 02:00:56 CEST 2024
$ TZ=Europe/Berlin date -d '2024-10-27T01:00:56 +00:00'Sun 27 Oct 02:00:56 CET 2024
The PHP DateTime class does not differentiate between these timestamps. However, when calling $ts->getTimestamp() it will always return the last value, even if it is in the future.
This library uses the $ts->getTimestamp() method to calculate a TTL for the object, which will then indicate that an object with an expiry of -1 seconds will be valid for nearly one hour.
Run this script during the transition from summer time to winter time using a non-UTC timezone to see the problem.
For example, using the faketime command and the Europe/Berlin time zone:
Summary
If PHP is configured with a non-UTC timezone, this library ends up caching objects that should not be cached when going from summer time to winter time.
Details
This library uses
new \DateTime('-1 seconds')
as an expiry timestamp for objects that should not be cached.E.g. in
src/Strategy/PrivateCacheStrategy.php#L112
:If PHP is configured with a non-UTC time zone, this breaks when going from summer time to winter time.
For example, both UTC time "2024-10-27 00:00:56" and "2024-10-27 01:00:56" was "2024-10-27 02:00:56" in timezone Europe/Berlin:
The PHP
DateTime
class does not differentiate between these timestamps. However, when calling$ts->getTimestamp()
it will always return the last value, even if it is in the future.This library uses the
$ts->getTimestamp()
method to calculate a TTL for the object, which will then indicate that an object with an expiry of-1 seconds
will be valid for nearly one hour.Here is an example script that shows the problem:
Run this script during the transition from summer time to winter time using a non-UTC timezone to see the problem.
For example, using the
faketime
command and theEurope/Berlin
time zone:The text was updated successfully, but these errors were encountered: