1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Deprecate date_sunrise and date_sunset constants (#12978)

RFC: https://wiki.php.net/rfc/deprecations_php_8_4
This commit is contained in:
Jorg Adam Sowa
2024-08-04 20:07:52 +02:00
committed by GitHub
parent 49d0d7bcd7
commit b9fef523c1
6 changed files with 23 additions and 5 deletions

4
NEWS
View File

@@ -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)

View File

@@ -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 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
- Intl:
. Calling intlcal_set() as well as calling IntlCalendar::set() with

View File

@@ -83,18 +83,21 @@ const DATE_W3C = DATE_RFC3339;
/**
* @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;

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: ec4cc71df0beb55d07dcc77d0bc47e1b67b48911 */
* Stub hash: 41c7662745d19808dd4550b37cd1b9f2aa94d75b */
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);
zend_attribute *attribute_Deprecated_func_strftime_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "strftime", sizeof("strftime") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED), 2);

View File

@@ -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 since 8.1, use date_sun_info() instead 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 since 8.1, use date_sun_info() instead in %s on line %d
%s %s %d %d, sunset time : %d:%d

View File

@@ -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===