diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php index 4f77fc9223e..6eef828b813 100644 --- a/ext/date/php_date.stub.php +++ b/ext/date/php_date.stub.php @@ -54,6 +54,7 @@ const DATE_RFC1123 = "D, d M Y H:i:s O"; * @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"; /** @@ -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; @@ -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; diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index c041d0b241d..07a4398ef1c 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c9dba59a68085579d18948963a979d63eecff204 */ + * Stub hash: db70e6a06d177d2cb6e4a47379c0b761b248f380 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0) @@ -798,7 +798,7 @@ static void register_php_date_symbols(int module_number) ZEND_ASSERT(strcmp(DATE_FORMAT_RFC1036, "D, d M y H:i:s O") == 0); REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_PERSISTENT); ZEND_ASSERT(strcmp(DATE_FORMAT_RFC1123, "D, d M Y H:i:s O") == 0); - REGISTER_STRING_CONSTANT("DATE_RFC7231", DATE_FORMAT_RFC7231, CONST_PERSISTENT); + zend_constant *const_DATE_RFC7231 = REGISTER_STRING_CONSTANT("DATE_RFC7231", DATE_FORMAT_RFC7231, CONST_PERSISTENT | CONST_DEPRECATED); ZEND_ASSERT(strcmp(DATE_FORMAT_RFC7231, "D, d M Y H:i:s \\G\\M\\T") == 0); REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_PERSISTENT); ZEND_ASSERT(strcmp(DATE_FORMAT_RFC2822, "D, d M Y H:i:s O") == 0); @@ -839,6 +839,13 @@ static void register_php_date_symbols(int module_number) ZVAL_STR_COPY(&attribute_Deprecated_func_date_sunset_0->args[1].value, attribute_Deprecated_func_date_sunrise_0_arg1_str); attribute_Deprecated_func_date_sunset_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + zend_attribute *attribute_Deprecated_const_DATE_RFC7231_0 = zend_add_global_constant_attribute(const_DATE_RFC7231, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); + ZVAL_STR(&attribute_Deprecated_const_DATE_RFC7231_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5)); + attribute_Deprecated_const_DATE_RFC7231_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + zend_string *attribute_Deprecated_const_DATE_RFC7231_0_arg1_str = zend_string_init("as this format ignores the associated timezone and always uses GMT", strlen("as this format ignores the associated timezone and always uses GMT"), 1); + ZVAL_STR(&attribute_Deprecated_const_DATE_RFC7231_0->args[1].value, attribute_Deprecated_const_DATE_RFC7231_0_arg1_str); + attribute_Deprecated_const_DATE_RFC7231_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + zend_attribute *attribute_Deprecated_const_SUNFUNCS_RET_TIMESTAMP_0 = zend_add_global_constant_attribute(const_SUNFUNCS_RET_TIMESTAMP, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); ZVAL_STR(&attribute_Deprecated_const_SUNFUNCS_RET_TIMESTAMP_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_4)); attribute_Deprecated_const_SUNFUNCS_RET_TIMESTAMP_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); @@ -926,7 +933,7 @@ static zend_class_entry *register_class_DateTimeInterface(void) zend_string *const_RFC7231_value_str = zend_string_init(DATE_FORMAT_RFC7231, strlen(DATE_FORMAT_RFC7231), 1); ZVAL_STR(&const_RFC7231_value, const_RFC7231_value_str); zend_string *const_RFC7231_name = zend_string_init_interned("RFC7231", sizeof("RFC7231") - 1, 1); - zend_declare_typed_class_constant(class_entry, const_RFC7231_name, &const_RFC7231_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); + zend_class_constant *const_RFC7231 = zend_declare_typed_class_constant(class_entry, const_RFC7231_name, &const_RFC7231_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); zend_string_release(const_RFC7231_name); zval const_RFC2822_value; @@ -964,6 +971,14 @@ static zend_class_entry *register_class_DateTimeInterface(void) zend_declare_typed_class_constant(class_entry, const_W3C_name, &const_W3C_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); zend_string_release(const_W3C_name); + + zend_attribute *attribute_Deprecated_const_RFC7231_0 = zend_add_class_constant_attribute(class_entry, const_RFC7231, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); + ZVAL_STR(&attribute_Deprecated_const_RFC7231_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5)); + attribute_Deprecated_const_RFC7231_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + zend_string *attribute_Deprecated_const_RFC7231_0_arg1_str = zend_string_init("as this format ignores the associated timezone and always uses GMT", strlen("as this format ignores the associated timezone and always uses GMT"), 1); + ZVAL_STR(&attribute_Deprecated_const_RFC7231_0->args[1].value, attribute_Deprecated_const_RFC7231_0_arg1_str); + attribute_Deprecated_const_RFC7231_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + return class_entry; } diff --git a/ext/date/tests/DateTimeImmutable_constants.phpt b/ext/date/tests/DateTimeImmutable_constants.phpt index 16de66e89f1..c3192231916 100644 --- a/ext/date/tests/DateTimeImmutable_constants.phpt +++ b/ext/date/tests/DateTimeImmutable_constants.phpt @@ -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) diff --git a/ext/date/tests/DateTimeInterface_constants.phpt b/ext/date/tests/DateTimeInterface_constants.phpt index c740ea4d951..d02eddf4d68 100644 --- a/ext/date/tests/DateTimeInterface_constants.phpt +++ b/ext/date/tests/DateTimeInterface_constants.phpt @@ -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) diff --git a/ext/date/tests/DateTime_constants.phpt b/ext/date/tests/DateTime_constants.phpt index bca573d8f72..fada757775c 100644 --- a/ext/date/tests/DateTime_constants.phpt +++ b/ext/date/tests/DateTime_constants.phpt @@ -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) diff --git a/ext/date/tests/DateTime_format_basic2.phpt b/ext/date/tests/DateTime_format_basic2.phpt index 2946cf2c681..a829f9c2163 100644 --- a/ext/date/tests/DateTime_format_basic2.phpt +++ b/ext/date/tests/DateTime_format_basic2.phpt @@ -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" @@ -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" diff --git a/ext/date/tests/bug74080.phpt b/ext/date/tests/bug74080.phpt deleted file mode 100644 index a86c78144e6..00000000000 --- a/ext/date/tests/bug74080.phpt +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -Bug #74080 Provide an RFC7231 date time format ---FILE-- - ---EXPECT-- -string(29) "Sat, 30 Apr 2016 17:52:13 GMT" diff --git a/ext/date/tests/date_constants.phpt b/ext/date/tests/date_constants.phpt index 27d93316655..2305ddbc312 100644 --- a/ext/date/tests/date_constants.phpt +++ b/ext/date/tests/date_constants.phpt @@ -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" @@ -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)