Skip to content

Commit 969a432

Browse files
committed
Merge branch 'PHP-7.4' into master
* PHP-7.4: Fix #80007: Potential type confusion in unixtojd() parameter parsing
2 parents 47c787f + 81fffa8 commit 969a432

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.0.0beta3
44

5+
- Calendar:
6+
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
7+
(Andy Postnikov)
8+
59
- DOM:
610
. Fixed bug #79968 (DOMChildNode API crash on unattached nodes). (Benjamin)
711

ext/calendar/cal_unix.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@
2525
PHP_FUNCTION(unixtojd)
2626
{
2727
time_t ts;
28-
zend_bool ts_is_null = 1;
28+
zend_long tl = 0;
29+
zend_bool tl_is_null = 1;
2930
struct tm *ta, tmbuf;
3031

31-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &ts, &ts_is_null) == FAILURE) {
32+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &tl, &tl_is_null) == FAILURE) {
3233
RETURN_THROWS();
3334
}
3435

35-
if (ts_is_null) {
36+
if (tl_is_null) {
3637
ts = time(NULL);
37-
} else if (ts < 0) {
38+
} else if (tl >= 0) {
39+
ts = (time_t) tl;
40+
} else {
3841
zend_argument_value_error(1, "must be greater than or equal to 0");
3942
RETURN_THROWS();
4043
}

0 commit comments

Comments
 (0)