1--TEST--
2Test date_parse() function : error conditions
3--FILE--
4<?php
5//Set the default time zone
6date_default_timezone_set("Europe/London");
7
8echo "*** Testing date_parse() : error conditions ***\n";
9
10echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n";
11$invalid_date = "2OO9-02--27 10:00?00.5";
12var_dump( date_parse($invalid_date) );
13
14?>
15--EXPECT--
16*** Testing date_parse() : error conditions ***
17
18-- Testing date_parse() function with unexpected characters in $date argument --
19array(13) {
20  ["year"]=>
21  bool(false)
22  ["month"]=>
23  bool(false)
24  ["day"]=>
25  bool(false)
26  ["hour"]=>
27  int(10)
28  ["minute"]=>
29  int(0)
30  ["second"]=>
31  int(0)
32  ["fraction"]=>
33  float(0)
34  ["warning_count"]=>
35  int(1)
36  ["warnings"]=>
37  array(1) {
38    [4]=>
39    string(29) "Double timezone specification"
40  }
41  ["error_count"]=>
42  int(7)
43  ["errors"]=>
44  array(7) {
45    [0]=>
46    string(20) "Unexpected character"
47    [1]=>
48    string(47) "The timezone could not be found in the database"
49    [3]=>
50    string(20) "Unexpected character"
51    [7]=>
52    string(20) "Unexpected character"
53    [8]=>
54    string(29) "Double timezone specification"
55    [17]=>
56    string(20) "Unexpected character"
57    [18]=>
58    string(25) "Double time specification"
59  }
60  ["is_localtime"]=>
61  bool(true)
62  ["zone_type"]=>
63  int(0)
64}
65