From 7cdd95bd22e5dda8c54c611c51e8981737209625 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Tue, 19 Dec 2023 22:39:47 +0100 Subject: [PATCH 1/5] Deprecate constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING and SUNFUNCS_RET_DOUBLE --- ext/date/php_date_arginfo.h | 6 +++--- ext/date/tests/date_sunrise_and_sunset_basic.phpt | 4 ++++ .../tests/internal_parameter_default_value/check_all.phpt | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index dc865bc866c88..76a046e86596c 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -844,9 +844,9 @@ static void register_php_date_symbols(int module_number) ZEND_ASSERT(strcmp(DATE_FORMAT_RFC3339_EXTENDED, "Y-m-d\\TH:i:s.vP") == 0); REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_PERSISTENT | CONST_DEPRECATED); + REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_PERSISTENT | CONST_DEPRECATED); + REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_PERSISTENT | CONST_DEPRECATED); } static zend_class_entry *register_class_DateTimeInterface(void) diff --git a/ext/date/tests/date_sunrise_and_sunset_basic.phpt b/ext/date/tests/date_sunrise_and_sunset_basic.phpt index 2a2e88cc60a0e..86af5a917ce18 100644 --- a/ext/date/tests/date_sunrise_and_sunset_basic.phpt +++ b/ext/date/tests/date_sunrise_and_sunset_basic.phpt @@ -25,9 +25,13 @@ var_dump(gettype(date_sunset(time()))); --EXPECTF-- Basic test for date_sunrise() and date_sunset() +Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d + Deprecated: Function date_sunrise() is deprecated in %s on line %d %s %s %d %d, sunrise time : %d:%d +Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d + Deprecated: Function date_sunset() is deprecated in %s on line %d %s %s %d %d, sunset time : %d:%d diff --git a/ext/reflection/tests/internal_parameter_default_value/check_all.phpt b/ext/reflection/tests/internal_parameter_default_value/check_all.phpt index 7bfe08bc56f14..534f781c4fc1a 100644 --- a/ext/reflection/tests/internal_parameter_default_value/check_all.phpt +++ b/ext/reflection/tests/internal_parameter_default_value/check_all.phpt @@ -29,5 +29,8 @@ foreach (get_declared_classes() as $class) { ?> ===DONE=== ---EXPECT-- +--EXPECTF-- +Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d + +Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d ===DONE=== From 00a0f41e1e8042d4f0b434f88e19ae5a9a6085a5 Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Wed, 20 Dec 2023 22:44:18 +0100 Subject: [PATCH 2/5] Added @deprecated PHPDoc comments to constants --- ext/date/php_date.stub.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php index b148262eb4b5c..d15ce53046d72 100644 --- a/ext/date/php_date.stub.php +++ b/ext/date/php_date.stub.php @@ -83,18 +83,21 @@ /** * @var int * @cvalue SUNFUNCS_RET_TIMESTAMP + * @deprecated */ const SUNFUNCS_RET_TIMESTAMP = UNKNOWN; /** * @var int * @cvalue SUNFUNCS_RET_STRING + * @deprecated */ const SUNFUNCS_RET_STRING = UNKNOWN; /** * @var int * @cvalue SUNFUNCS_RET_DOUBLE + * @deprecated */ const SUNFUNCS_RET_DOUBLE = UNKNOWN; From bee7d42611234cbc6b727355f6ad5bb7925b3f0a Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Tue, 19 Mar 2024 08:12:23 +0100 Subject: [PATCH 3/5] Updated date stub --- ext/date/php_date_arginfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index 76a046e86596c..cf57c4e746702 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: 199789cfbbb53ead5c5418ae30935ffdd7c9685f */ + * Stub hash: 07e428c89eb8a7ea12281e1f7c12b344fd326c23 */ 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) From 42aab8b2bfd37407a1c1265cab7778f279d13e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 4 Aug 2024 18:47:22 +0200 Subject: [PATCH 4/5] NEWS/UPGRADING --- NEWS | 4 ++++ UPGRADING | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 5d237a6460c62..7980ff66c4480 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ PHP NEWS . Updated build system scripts config.guess to 2024-07-27 and config.sub to 2024-05-27. (Peter Kokot) +- Date: + . Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and SUNFUNCS_RET_DOUBLE + are now deprecated. (Jorg Sowa) + - DOM: . Fixed bug GH-15192 (Segmentation fault in dom extension (html5_serializer)). (nielsdos) diff --git a/UPGRADING b/UPGRADING index e41faf5dd40ed..ff936d794d232 100644 --- a/UPGRADING +++ b/UPGRADING @@ -404,6 +404,10 @@ PHP 8.4 UPGRADE NOTES - Date: . Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated. Use DatePeriod::createFromISO8601String() instead. + . Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and + SUNFUNCS_RET_DOUBLE are not deprecated, following the deprecation of + the associated date_sunset() and date_sunrise() functions in PHP 8.1. + RFC: https://wiki.php.net/rfc/deprecations_php_8_4 - Intl: . Calling intlcal_set() as well as calling IntlCalendar::set() with From f9bfbc18ff6a7da3432ac2b7c13671ab12751100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 4 Aug 2024 18:50:39 +0200 Subject: [PATCH 5/5] Fix typo in UPGRADING --- UPGRADING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING b/UPGRADING index ff936d794d232..96bb46e139473 100644 --- a/UPGRADING +++ b/UPGRADING @@ -405,7 +405,7 @@ PHP 8.4 UPGRADE NOTES . Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated. Use DatePeriod::createFromISO8601String() instead. . Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and - SUNFUNCS_RET_DOUBLE are not deprecated, following the deprecation of + SUNFUNCS_RET_DOUBLE are now deprecated, following the deprecation of the associated date_sunset() and date_sunrise() functions in PHP 8.1. RFC: https://wiki.php.net/rfc/deprecations_php_8_4