Skip to content

RFC: Deprecate date constant RFC7231 #12989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jorgsowa
Copy link
Contributor

@jorgsowa jorgsowa commented Dec 20, 2023

This PR deprecates constants DATE_RFC7231 and DateTimeInterface::RFC7231.

Because the implementation of the constant contains the timezone GMT designation, the format of date will always show the GMT timezone, despite the real timezone of the instance of DateTimeInterface. This may lead to unwanted results.

The implementation of this constant was a mistake, as this was described as bug. This wasn't bug, this was missing functionality: #2450

Example of wrong display of datetime:

$date = new \DateTime();
$date->setTimeZone(new DateTimeZone('GMT')); //Wed, 20 Dec 2023 23:28:11 GMT
echo $date->format(DATE_RFC7231)."\n";
$date->setTimeZone(new DateTimeZone('Europe/Tallinn')); //Thu, 21 Dec 2023 01:28:20 GMT
echo $date->format(DATE_RFC7231);

https://3v4l.org/5Oh7Z

I also suggest adding this to the collective RFC https://wiki.php.net/rfc/deprecations_php_8_4 What do you think @Girgias?

@Girgias
Copy link
Member

Girgias commented Dec 22, 2023

Adding this to the mass deprecation makes sense, but I would want to wait for @derickr's opinion, but he's on holidays for 2 (3?) weeks. Please ping us again in January if we forget this :/

Copy link
Member

@derickr derickr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with this being added to the 8.4 deprecations. I wonder whether we can also not clean up some of the tests to not even use this constant in there, as there are now so many deprecation warnings in the test. I suggest we only keep the tests for these constants for DateTimeInterface_constants. No biggy though, but just as well we can clean up something here.

@jorgsowa jorgsowa requested a review from kocsismate as a code owner April 15, 2024 15:43
@medabkari
Copy link

Is this still part of the deprecation list for 8.4?

@jorgsowa
Copy link
Contributor Author

Unfortunately no. I completely forgot about this PR and I didn't add this for the 8.4 deprecations collection. I will add for the next one.

@jorgsowa
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants