File tree Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 9
9
(cmb)
10
10
. Fixed bug #80126 (Covariant return types failing compilation). (Nikita)
11
11
12
+ - Calendar:
13
+ . Fixed bug #80185 (jdtounix() fails after 2037). (cmb)
14
+
12
15
- MySQLnd:
13
16
. Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with
14
17
slashes). (cmb)
Original file line number Diff line number Diff line change 23
23
#include "sdncal.h"
24
24
#include <time.h>
25
25
26
+ #define SECS_PER_DAY (24 * 3600)
27
+
26
28
/* {{{ proto int unixtojd([int timestamp])
27
29
Convert UNIX timestamp to Julian Day */
28
30
PHP_FUNCTION (unixtojd )
@@ -62,10 +64,10 @@ PHP_FUNCTION(jdtounix)
62
64
}
63
65
uday -= 2440588 /* J.D. of 1.1.1970 */ ;
64
66
65
- if (uday < 0 || uday > 24755 ) { /* before beginning of unix epoch or behind end of unix epoch */
67
+ if (uday < 0 || uday > ZEND_LONG_MAX / SECS_PER_DAY ) { /* before beginning of unix epoch or greater than representable */
66
68
RETURN_FALSE ;
67
69
}
68
70
69
- RETURN_LONG (uday * 24 * 3600 );
71
+ RETURN_LONG (uday * SECS_PER_DAY );
70
72
}
71
73
/* }}} */
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #80185 (jdtounix() fails after 2037)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('calendar ' )) die ('skip ext/calendar required ' );
6
+ if (PHP_INT_SIZE != 8 ) die ("skip for 64bit platforms only " );
7
+ ?>
8
+ --FILE--
9
+ <?php
10
+ var_dump (jdtounix (2465712 ));
11
+ var_dump (jdtounix (PHP_INT_MAX / 86400 + 2440588 ));
12
+ var_dump (jdtounix (PHP_INT_MAX / 86400 + 2440589 ));
13
+ ?>
14
+ --EXPECT--
15
+ int(2170713600)
16
+ int(9223372036854720000)
17
+ bool(false)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #80185 (jdtounix() fails after 2037)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('calendar ' )) die ('skip ext/calendar required ' );
6
+ if (PHP_INT_SIZE != 4 ) die ("skip for 32bit platforms only " );
7
+ ?>
8
+ --FILE--
9
+ <?php
10
+ var_dump (jdtounix (2465712 ));
11
+ var_dump (jdtounix (PHP_INT_MAX / 86400 + 2440588 ));
12
+ var_dump (jdtounix (PHP_INT_MAX / 86400 + 2440589 ));
13
+ ?>
14
+ --EXPECT--
15
+ bool(false)
16
+ int(2147472000)
17
+ bool(false)
You can’t perform that action at this time.
0 commit comments