Skip to content

Commit 7448ee3

Browse files
committedSep 14, 2022
Add test case for timelib #124
1 parent f8b27c7 commit 7448ee3

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
 

‎ext/date/tests/bug40861.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ echo $result . "\n";
2828
?>
2929
--EXPECT--
3030
2000-01-01 13:00:00
31-
2000-01-01 11:00:00
3231
2000-01-01 13:00:00
32+
2000-01-01 11:00:00
3333
2000-01-01 13:00:00

‎ext/date/tests/gh-124.phpt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Test for timelib #124: Problem with large negative timestamps
3+
--INI--
4+
date.timezone=UTC
5+
--FILE--
6+
<?php
7+
var_dump((new DateTime("@-9223372036854775808"))->getTimestamp());
8+
var_dump((new DateTime('-292277022657-01-27 08:29:52 UTC'))->getTimestamp());
9+
var_dump((new DateTime('-292277022657-01-27 08:29:53 UTC'))->getTimestamp());
10+
11+
var_dump((new DateTime("@9223372036854775807"))->getTimestamp());
12+
var_dump((new DateTime('+292277026596-12-04 15:30:07 UTC'))->getTimestamp());
13+
echo (new DateTime('+2512370164-01-01 00:00:00Z'))->format(DATE_RFC3339_EXTENDED);
14+
?>
15+
--EXPECT--
16+
int(-9223372036854775808)
17+
int(-9223372036854775808)
18+
int(-9223372036854775807)
19+
int(9223372036854775807)
20+
int(9223372036854775807)
21+
2512370164-01-01T00:00:00.000+00:00

0 commit comments

Comments
 (0)