xref: /PHP-5.3/ext/date/tests/bug35499.phpt (revision 4b64dbb9)
1--TEST--
2Bug #35499 (strtotime() does not handle whitespace around the date string)
3--FILE--
4<?php
5date_default_timezone_set("UTC");
6
7echo date(DATE_ISO8601, strtotime("11/20/2005 8:00 AM \r\n")) . "\n";
8echo date(DATE_ISO8601, strtotime("  11/20/2005 8:00 AM \r\n")) . "\n";
9var_dump(date_parse(" a "));
10var_dump(date_parse(" \n "));
11?>
12--EXPECT--
132005-11-20T08:00:00+0000
142005-11-20T08:00:00+0000
15array(16) {
16  ["year"]=>
17  bool(false)
18  ["month"]=>
19  bool(false)
20  ["day"]=>
21  bool(false)
22  ["hour"]=>
23  bool(false)
24  ["minute"]=>
25  bool(false)
26  ["second"]=>
27  bool(false)
28  ["fraction"]=>
29  bool(false)
30  ["warning_count"]=>
31  int(0)
32  ["warnings"]=>
33  array(0) {
34  }
35  ["error_count"]=>
36  int(0)
37  ["errors"]=>
38  array(0) {
39  }
40  ["is_localtime"]=>
41  bool(true)
42  ["zone_type"]=>
43  int(2)
44  ["zone"]=>
45  int(-60)
46  ["is_dst"]=>
47  bool(false)
48  ["tz_abbr"]=>
49  string(1) "A"
50}
51array(12) {
52  ["year"]=>
53  bool(false)
54  ["month"]=>
55  bool(false)
56  ["day"]=>
57  bool(false)
58  ["hour"]=>
59  bool(false)
60  ["minute"]=>
61  bool(false)
62  ["second"]=>
63  bool(false)
64  ["fraction"]=>
65  bool(false)
66  ["warning_count"]=>
67  int(0)
68  ["warnings"]=>
69  array(0) {
70  }
71  ["error_count"]=>
72  int(0)
73  ["errors"]=>
74  array(0) {
75  }
76  ["is_localtime"]=>
77  bool(false)
78}
79