File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ MongoDB\BSON\ObjectId::getTimestamp: Ensure that the Timestamp field is represented as an unsigned 32-bit integer
3
+ --FILE--
4
+ <?php
5
+ date_default_timezone_set ("UTC " );
6
+
7
+ function create_object_id ($ oid_string )
8
+ {
9
+ $ objectid = new MongoDB \BSON \ObjectId ($ oid_string );
10
+ $ ts = sprintf ("%u " , $ objectid ->getTimestamp ());
11
+ echo $ ts , "\n" ;
12
+ echo date_create ("@ {$ ts }" )->format ("Y-m-d H:i:s " ), "\n" ;
13
+ }
14
+
15
+ create_object_id ('000000000000000000000000 ' );
16
+ create_object_id ('7FFFFFFF0000000000000000 ' );
17
+ create_object_id ('800000000000000000000000 ' );
18
+ create_object_id ('FFFFFFFF0000000000000000 ' );
19
+
20
+ ?>
21
+ --EXPECT--
22
+ 0
23
+ 1970-01-01 00:00:00
24
+ 2147483647
25
+ 2038-01-19 03:14:07
26
+ 2147483648
27
+ 2038-01-19 03:14:08
28
+ 4294967295
29
+ 2106-02-07 06:28:15
You can’t perform that action at this time.
0 commit comments