Replace REQUEST_TIME in services

Created on 16 February 2020, about 4 years ago
Updated 13 February 2024, 11 days 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 less than a minute 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
2 months ago
Sign in to follow issues

Merge Requests

Comments & Activities

Production build https://api.contrib.social 0.61.6-2-g546bc20