Problem/Motivation

 * @deprecated in drupal:8.3.0 and is removed from drupal:10.0.0.
 *   Use \Drupal::time()->getRequestTime();
 */
define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']);

We did not complete the removal of this in time for Drupal 10, and so we need to bump it to Drupal 11.

Steps to reproduce

Proposed resolution

Update the deprecation notice and any other references.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3318985-2.patch535 bytesandypost

Comments

longwave created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
StatusFileSize
new535 bytes

Here's patch but phpstan-drupal will also need to fix it in https://github.com/mglaman/phpstan-drupal/blob/1.1.25/src/Rules/Deprecat...

There's 23 usages left

$ git grep -F "SERVER['REQUEST_TIME']"
core/includes/bootstrap.inc:42: * This differs from $_SERVER['REQUEST_TIME'], which is stored as a float
core/includes/bootstrap.inc:54:define('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']);
core/lib/Drupal/Component/Datetime/Time.php:39:    return $_SERVER['REQUEST_TIME'] ?? $this->getCurrentTime();
core/lib/Drupal/Component/Datetime/TimeInterface.php:22:   * $request_time = $_SERVER['REQUEST_TIME'];
core/lib/Drupal/Core/Cache/MemoryBackend.php:204:    return defined('REQUEST_TIME') ? REQUEST_TIME : (int) $_SERVER['REQUEST_TIME'];
core/modules/comment/comment.module:40:define('COMMENT_NEW_LIMIT', ((int) $_SERVER['REQUEST_TIME']) - 30 * 24 * 60 * 60);
core/modules/history/history.module:26:define('HISTORY_READ_LIMIT', ((int) $_SERVER['REQUEST_TIME']) - 30 * 24 * 60 * 60);
core/modules/path_alias/src/AliasManager.php:296:    return defined('REQUEST_TIME') ? REQUEST_TIME : (int) $_SERVER['REQUEST_TIME'];
core/modules/path_alias/tests/src/Unit/AliasManagerTest.php:205:      ->with($this->cacheKey, [$language->getId() => [$path]], (int) $_SERVER['REQUEST_TIME'] + (60 * 60 * 24));
core/modules/path_alias/tests/src/Unit/AliasManagerTest.php:243:      ->with($this->cacheKey, [$language->getId() => [$path]], (int) $_SERVER['REQUEST_TIME'] + (60 * 60 * 24));
core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php:100:    $lock = new Lock(2, (int) $_SERVER['REQUEST_TIME']);
core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php:105:    $lock = new Lock(1, (int) $_SERVER['REQUEST_TIME']);
core/scripts/generate-d7-content.sh:240:  $node->created = $_SERVER['REQUEST_TIME'] + $i * 43200;
core/scripts/run-tests.sh:1043:  echo "  " . date('l, F j, Y - H:i', $_SERVER['REQUEST_TIME']) . "\n";
core/tests/Drupal/Tests/Component/Datetime/TimeTest.php:87:    unset($_SERVER['REQUEST_TIME']);
core/tests/Drupal/Tests/Component/Datetime/TimeTest.php:89:    $_SERVER['REQUEST_TIME'] = 23456789;
core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php:117:      'created' => (int) $_SERVER['REQUEST_TIME'],
core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php:229:          'created' => (int) $_SERVER['REQUEST_TIME'],
core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php:233:          'created' => (int) $_SERVER['REQUEST_TIME'] + 1,
core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php:278:      'created' => (int) $_SERVER['REQUEST_TIME'] + 1,
core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php:304:      'created' => (int) $_SERVER['REQUEST_TIME'],
core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php:43:    $timestamp_item = (object) ['cid' => $timestamp_cid, 'data' => (int) $_SERVER['REQUEST_TIME'] - 60];
core/tests/Drupal/Tests/Core/Render/RendererTest.php:881:      [60, TRUE, (int) $_SERVER['REQUEST_TIME'] + 60],
core/tests/Drupal/Tests/Core/Render/RendererTestBase.php:144:    $request->server->set('REQUEST_TIME', $_SERVER['REQUEST_TIME']);
core/tests/Drupal/Tests/Core/Render/RendererTestBase.php:235:    $request->server->set('REQUEST_TIME', (int) $_SERVER['REQUEST_TIME']);
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thank you @andypost.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 29f7f401a0 to 10.1.x and a1d293d751 to 10.0.x and 79d3892aed to 9.5.x and ed12a35c95 to 9.4.x. Thanks!

  • alexpott committed 29f7f40 on 10.1.x
    Issue #3318985 by andypost, longwave: Bump REQUEST_TIME deprecation to...

  • alexpott committed a1d293d on 10.0.x
    Issue #3318985 by andypost, longwave: Bump REQUEST_TIME deprecation to...

  • alexpott committed 79d3892 on 9.5.x
    Issue #3318985 by andypost, longwave: Bump REQUEST_TIME deprecation to...

  • alexpott committed ed12a35 on 9.4.x
    Issue #3318985 by andypost, longwave: Bump REQUEST_TIME deprecation to...
andypost’s picture

longwave’s picture

Issue tags: -Drupal 10 rc blocker

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.