Convert UNKNOWN default values to null in ext/calendar

This commit is contained in:
Máté Kocsis 2020-05-01 20:49:55 +02:00
parent 8a41c9e025
commit 089d8cb03c
No known key found for this signature in database
GPG key ID: FD055E41728BF310
5 changed files with 19 additions and 20 deletions

View file

@ -25,14 +25,15 @@
Convert UNIX timestamp to Julian Day */
PHP_FUNCTION(unixtojd)
{
time_t ts = 0;
time_t ts;
zend_bool ts_is_null = 1;
struct tm *ta, tmbuf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &ts, &ts_is_null) == FAILURE) {
RETURN_THROWS();
}
if (!ts) {
if (ts_is_null) {
ts = time(NULL);
} else if (ts < 0) {
zend_argument_value_error(1, "must be greater than or equal to 0");