diff --git a/UPGRADING b/UPGRADING index daf712a5dce8e..2aa5ea61d5b22 100644 --- a/UPGRADING +++ b/UPGRADING @@ -278,6 +278,10 @@ PHP 8.4 UPGRADE NOTES - Date: . Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated. Use DatePeriod::createFromISO8601String() instead. + . SUNFUNCS_RET_STRING, SUNFUNCS_RET_DOUBLE, and SUNFUNCS_RET_TIMESTAMP + constants are deprecated. They are only used as parameters to the + date_sunrise() and date_sunset() function, which are deprecated + since PHP 8.1. - Intl: . Calling intlcal_set() as well as calling IntlCalendar::set() with 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; diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index dc865bc866c88..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) @@ -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/date/tests/sun_consts_deprecated.phpt b/ext/date/tests/sun_consts_deprecated.phpt new file mode 100644 index 0000000000000..91cd24287d788 --- /dev/null +++ b/ext/date/tests/sun_consts_deprecated.phpt @@ -0,0 +1,19 @@ +--TEST-- +SUNFUNCS_RET_STRING, SUNFUNCS_RET_DOUBLE, and SUNFUNCS_RET_TIMESTAMP constants are deprecated +--FILE-- + +--EXPECTF-- +Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d +int(1) + +Deprecated: Constant SUNFUNCS_RET_DOUBLE is deprecated in %s on line %d +int(2) + +Deprecated: Constant SUNFUNCS_RET_TIMESTAMP is deprecated in %s on line %d +int(0)