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 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ext/date/php_date.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* @var string
* @cvalue DATE_FORMAT_RFC7231
*/
#[\Deprecated(since: '8.5', message: "as this format ignores the associated timezone and always uses GMT")]
const DATE_RFC7231 = "D, d M Y H:i:s \\G\\M\\T";

/**
Expand Down Expand Up @@ -287,7 +288,6 @@ function date_sun_info(int $timestamp, float $latitude, float $longitude): array

interface DateTimeInterface
{

public const string ATOM = DATE_ATOM;

public const string COOKIE = DATE_COOKIE;
Expand All @@ -304,6 +304,7 @@ interface DateTimeInterface

public const string RFC1123 = DATE_RFC1123;

#[\Deprecated(since: '8.5', message: "as this format ignores the associated timezone and always uses GMT")]
public const string RFC7231 = DATE_RFC7231;

public const string RFC2822 = DATE_RFC2822;
Expand Down
21 changes: 18 additions & 3 deletions ext/date/php_date_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion ext/date/tests/DateTimeImmutable_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ var_dump(
);

?>
--EXPECT--
--EXPECTF--
Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d

Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d
bool(true)
bool(true)
bool(true)
Expand Down
5 changes: 4 additions & 1 deletion ext/date/tests/DateTimeInterface_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ var_dump(
);

?>
--EXPECT--
--EXPECTF--
Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d

Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d
bool(true)
bool(true)
bool(true)
Expand Down
5 changes: 4 additions & 1 deletion ext/date/tests/DateTime_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ var_dump(
);

?>
--EXPECT--
--EXPECTF--
Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d

Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d
bool(true)
bool(true)
bool(true)
Expand Down
4 changes: 3 additions & 1 deletion ext/date/tests/DateTime_format_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var_dump($date->format(DateTime::RSS));
var_dump($date->format(DateTime::W3C));

?>
--EXPECT--
--EXPECTF--
*** Testing date_format() : basic functionality - formatting constants ***
string(25) "2005-07-14T22:30:41+01:00"
string(34) "Thursday, 14-Jul-2005 22:30:41 BST"
Expand All @@ -34,6 +34,8 @@ string(29) "Thu, 14 Jul 05 22:30:41 +0100"
string(32) "Thursday, 14-Jul-05 22:30:41 BST"
string(29) "Thu, 14 Jul 05 22:30:41 +0100"
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"

Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d
string(29) "Thu, 14 Jul 2005 22:30:41 GMT"
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
string(25) "2005-07-14T22:30:41+01:00"
Expand Down
11 changes: 0 additions & 11 deletions ext/date/tests/bug74080.phpt

This file was deleted.

7 changes: 6 additions & 1 deletion ext/date/tests/date_constants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Date constants
DATE_W3C == DateTime::W3C
);
?>
--EXPECT--
--EXPECTF--
Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d
string(25) "2006-07-01T14:27:30+02:00"
string(25) "2006-05-30T14:32:13+02:00"
string(35) "Saturday, 01-Jul-2006 14:27:30 CEST"
Expand Down Expand Up @@ -74,6 +75,10 @@ string(31) "Tue, 30 May 2006 14:32:13 +0200"
string(25) "2006-07-01T14:27:30+02:00"
string(25) "2006-05-30T14:32:13+02:00"


Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d

Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d
bool(true)
bool(true)
bool(true)
Expand Down