Problem/Motivation

#1209470: REQUEST_TIME is a float with microseconds on PHP 5.4 introduced casts on REQUEST_TIME because of a temporary change in PHP5.4. We can remove them.

Proposed resolution

- remove the cast from the define()
- remove casts from usages of $_SERVER['REQUEST_TIME']
- remove casts from usages of $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME') (and similar usages where REQUEST_TIME is retrieved from something injected or \Drupal::request() or \Drupal::requestStack()).

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpdonadio created an issue. See original summary.

mpdonadio’s picture

Status: Active » Needs work
FileSize
12.99 KB

See attached for work in progress; this needs to be rerolled for 8.4.x.

I will get issue credits transferred over.

nachosalvador’s picture

Assigned: Unassigned » nachosalvador
nachosalvador’s picture

nachosalvador’s picture

Status: Needs work » Needs review

The last submitted patch, 2: request_time_is_a_float-1209470-32.patch, failed testing.

mpdonadio’s picture

Status: Needs review » Needs work

Looks good; still need to get the credit list over, but there is at least one more usage:

$ find core -type f | xargs grep REQUEST_TIME | grep '(int)'
core/modules/user/src/SharedTempStore.php:      'updated' => (int) $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'),
nachosalvador’s picture

Good catch! :)

Included in this new patch.

mpdonadio’s picture

Assigned: nachosalvador » mpdonadio

Need to do a proper review with it applied.

Looks like Munavijayalakshmi, anchal29, mpdonadio had patches on the other issue for 8.x

Looks like jibran, gnuget, agomezmoron reviewed the 8.x patches.

mpdonadio’s picture

Assigned: mpdonadio » Unassigned

Ok, looked at #8

$ find core -type f | xargs grep REQUEST_TIME | grep '(int)' | wc -l
       0

That is good. Manually looked at patch, and don't see any out-of-scope oopsies.

$ find core -type f | xargs grep REQUEST_TIME | grep 'int'

brings up non casts, and two odd intval() in DateHelper, but I think that is OOS.

I scanned

$ find core -type f | xargs grep REQUEST_TIME

but there are 349 uses(!) of REQUEST_TIME in one form or another. Nothing popped out at me.

This looks good to me. You could say it has some of my work in it from a while ago, so I feel a little uneasy setting RTBC on this.

osopolar’s picture

Just wondering, about define('REQUEST_TIME', $_SERVER['REQUEST_TIME']);, as it is said there:

@deprecated in Drupal 8.3.0, will be removed before Drupal 9.0.0.
Use \Drupal::time()->getRequestTime();

Wouldn't it make sense to actually use \Drupal::time()->getRequestTime(); everywhere else in the patch, where $_SERVER['REQUEST_TIME'] is used?

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs review » Closed (outdated)

REQUEST_TIME was deprecated in Drupal 8.3.0, https://www.drupal.org/node/2785211. Therefor, closing as outdated.