Skip to content

Commit 165a053

Browse files
committed
fixup! Convert UNKNOWN default values to null in ext/calendar
1 parent 3ba5660 commit 165a053

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

ext/calendar/cal_unix.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@
2525
Convert UNIX timestamp to Julian Day */
2626
PHP_FUNCTION(unixtojd)
2727
{
28-
time_t ts;
29-
zend_bool ts_is_null = 1;
28+
time_t ts = -1;
3029
struct tm *ta, tmbuf;
3130

32-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &ts, &ts_is_null) == FAILURE) {
31+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
3332
RETURN_THROWS();
3433
}
3534

36-
if (ts_is_null) {
35+
if (ts == -1) {
3736
ts = time(NULL);
3837
} else if (ts < 0) {
3938
zend_argument_value_error(1, "must be greater than or equal to 0");

ext/calendar/calendar.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ function jewishtojd(int $month, int $day, int $year): int {}
3636

3737
function juliantojd(int $month, int $day, int $year): int {}
3838

39-
function unixtojd(?int $timestamp = null): int|false {}
39+
function unixtojd(int $timestamp = -1): int|false {}

ext/calendar/calendar_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ZEND_END_ARG_INFO()
7070
#define arginfo_juliantojd arginfo_frenchtojd
7171

7272
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_unixtojd, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
73-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 1, "null")
73+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 0, "-1")
7474
ZEND_END_ARG_INFO()
7575

7676

0 commit comments

Comments
 (0)