Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We've deprecated REQUEST_TIME in favour of \Drupal::time() and the Time service but that has a hidden dependency on the Symfony HttpKernel (eg, \Drupal\Core\DrupalKernel::preHandle()
) and the request being placed on the request stack.
Proposed resolution
Fallback sensibly when this is not available.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/a
Comments
Comment #2
alexpottComment #3
alexpottSo in our REQUEST_TIME docs we say
But there's zero evidence of the int cast being necessary - see https://3v4l.org/VKWSU
Comment #4
alexpottLol we never did revert #1209470: REQUEST_TIME is a float with microseconds on PHP 5.4
Comment #5
alexpottOr complete #2862477: Remove casts from REQUEST_TIME
Comment #6
andypostComment #7
mpdonadioRTBC assuming the precautionary PHP version tests pass.
Adjusting the IS. Since this is Component and not Core, it is really a Symfony thing and not DrupalKernel thing.
Comment #11
catchCommitted da21d14 and pushed to 9.0.x. Thanks! Cherry-picked to 8.9.x and 8.8.x