Skip to content

Commit 81fffa8

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #80007: Potential type confusion in unixtojd() parameter parsing
2 parents 1b21b56 + b2a33ab commit 81fffa8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2020, PHP 7.4.11
44

5+
- Calendar:
6+
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
7+
(Andy Postnikov)
58

69
03 Sep 2020, PHP 7.4.10
710

ext/calendar/cal_unix.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@
2828
PHP_FUNCTION(unixtojd)
2929
{
3030
time_t ts = 0;
31+
zend_long tl = 0;
3132
struct tm *ta, tmbuf;
3233

33-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
34+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &tl) == FAILURE) {
3435
return;
3536
}
3637

37-
if (!ts) {
38+
if (!tl) {
3839
ts = time(NULL);
39-
} else if (ts < 0) {
40+
} else if (tl >= 0) {
41+
ts = (time_t) tl;
42+
} else {
4043
RETURN_FALSE;
4144
}
4245

0 commit comments

Comments
 (0)