Replace REQUEST_TIME in services

Created on 16 February 2020, over 4 years ago
Updated 27 February 2024, 5 months ago

Problem/Motivation

A time service was added to 8.3.x in #2717207: Add a time service to provide consistent interaction with time()/microtime() and superglobals .

Core code should be updated to remove deprecated uses of REQUEST_TIME and time() and others.

For more informations, see the change record .

This issue deals specifically with replace those calls in services.

The services that were identified to have those calls are:

  • \Drupal\Core\Asset\JsCollectionRenderer
  • \Drupal\Core\Cache\ApcuBackend
  • \Drupal\Core\Cache\ApcuBackendFactory
  • \Drupal\Core\Cache\DatabaseBackend
  • \Drupal\Core\Cache\DatabaseBackendFactory
  • \Drupal\Core\Cache\MemoryBackend
  • \Drupal\Core\Cache\MemoryBackendFactory
  • \Drupal\Core\Cache\MemoryCounterBackendFactory
  • \Drupal\Core\Cache\PhpBackend
  • \Drupal\Core\Cache\PhpBackendFactory
  • \Drupal\Core\EventSubscriber\FinishResponseSubscriber
  • \Drupal\Core\Flood\DatabaseBackend
  • \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory
  • \Drupal\Core\Session\SessionHandler
  • \Drupal\Core\Session\SessionManager
  • \Drupal\comment\CommentStatistics
  • \Drupal\path_alias\AliasManager
  • \Drupal\search\SearchIndex
  • \Drupal\update\UpdateProcessor
  • \Drupal\user\EventSubscriber\UserRequestSubscriber

Proposed resolution

- Remove deprecated uses of REQUEST_TIME and time() and others.
- When this issue is successful, there should be no suppressions left in core/phpstan-baseline.neon for the above mentioned classes with the message Call to deprecated constant REQUEST_TIME: Deprecated in drupal:8.3.0 and is removed from drupal:11.0.0. Use \Drupal::time()->getRequestTime();

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Base 

Last updated about 8 hours ago

Created by

🇺🇸United States mpdonadio Philadelphia/PA/USA (UTC-5)

Live updates comments and jobs are added and updated live.

Missing content requested by

🇦🇺Australia dpi
7 months ago
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024