Skip to content

Deprecate DATE_RET_* constants (related to date_sunrise/date_sunset) #7248

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

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ext/date/php_date.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions ext/date/php_date_arginfo.h

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

4 changes: 4 additions & 0 deletions ext/date/tests/date_sunrise_and_sunset_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 19 additions & 0 deletions ext/date/tests/sun_consts_deprecated.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
SUNFUNCS_RET_STRING, SUNFUNCS_RET_DOUBLE, and SUNFUNCS_RET_TIMESTAMP constants are deprecated
--FILE--
<?php

var_dump(SUNFUNCS_RET_STRING);
var_dump(SUNFUNCS_RET_DOUBLE);
var_dump(SUNFUNCS_RET_TIMESTAMP);

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