xref: /PHP-5.6/ext/date/tests/bug41523-64bit.phpt (revision fdb2709d)
1--TEST--
2Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (64 bit)
3--SKIPIF--
4<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?>
5--FILE--
6<?php
7date_default_timezone_set("UTC");
8
9var_dump( date_parse('0000-00-00 00:00:00') );
10var_dump( strtotime('0000-00-00 00:00:00') );
11var_dump( $dt = new DateTime('0000-00-00 00:00:00') );
12echo $dt->format( DateTime::ISO8601 ), "\n";
13
14?>
15--EXPECT--
16array(12) {
17  ["year"]=>
18  int(0)
19  ["month"]=>
20  int(0)
21  ["day"]=>
22  int(0)
23  ["hour"]=>
24  int(0)
25  ["minute"]=>
26  int(0)
27  ["second"]=>
28  int(0)
29  ["fraction"]=>
30  float(0)
31  ["warning_count"]=>
32  int(1)
33  ["warnings"]=>
34  array(1) {
35    [20]=>
36    string(27) "The parsed date was invalid"
37  }
38  ["error_count"]=>
39  int(0)
40  ["errors"]=>
41  array(0) {
42  }
43  ["is_localtime"]=>
44  bool(false)
45}
46int(-62169984000)
47object(DateTime)#1 (3) {
48  ["date"]=>
49  string(27) "-0001-11-30 00:00:00.000000"
50  ["timezone_type"]=>
51  int(3)
52  ["timezone"]=>
53  string(3) "UTC"
54}
55-0001-11-30T00:00:00+0000
56