[php-src] PR #12989: RFC: Deprecate date constant RFC7231
| From: | jorgsowa | Date: | Thu, 21 Dec 2023 00:08:48 +0000 |
| Subject: | [php-src] PR #12989: RFC: Deprecate date constant RFC7231 | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24554@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12989
Author: jorgsowa
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 method was a mistake, as this was described as bug. This wasn't bug,
this was missing functionality: https://github.com/php/php-src/pull/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?