xref: /PHP-8.1/ext/date/tests/bug43808.phpt (revision f8d79582)
1--TEST--
2Bug #43808 (date_create never fails (even when it should))
3--FILE--
4<?php
5$date = date_create('asdfasdf');
6
7if ($date instanceof DateTime) {
8    echo "this is wrong, should be bool";
9}
10
11var_dump( $date );
12var_dump( DateTime::getLastErrors() );
13var_dump( date_get_last_errors() );
14?>
15--EXPECT--
16bool(false)
17array(4) {
18  ["warning_count"]=>
19  int(1)
20  ["warnings"]=>
21  array(1) {
22    [6]=>
23    string(29) "Double timezone specification"
24  }
25  ["error_count"]=>
26  int(1)
27  ["errors"]=>
28  array(1) {
29    [0]=>
30    string(47) "The timezone could not be found in the database"
31  }
32}
33array(4) {
34  ["warning_count"]=>
35  int(1)
36  ["warnings"]=>
37  array(1) {
38    [6]=>
39    string(29) "Double timezone specification"
40  }
41  ["error_count"]=>
42  int(1)
43  ["errors"]=>
44  array(1) {
45    [0]=>
46    string(47) "The timezone could not be found in the database"
47  }
48}
49