Annotation of embedaddon/php/ext/date/tests/bug51393.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #51393 (DateTime::createFromFormat() fails if format string contains timezone)
3: --INI--
4: date.timezone=UTC
5: --FILE--
6: <?php
7: $dt = DateTime::createFromFormat('O', '+0800');
8: var_dump($dt->getOffset());
9:
10: $dt = DateTime::createFromFormat('P', '+08:00');
11: var_dump($dt->getOffset());
12:
13: $dt = DateTime::createFromFormat('O', '-0800');
14: var_dump($dt->getOffset());
15:
16: $dt = DateTime::createFromFormat('P', '-08:00');
17: var_dump($dt->getOffset());
18:
19: $dt = DateTime::createFromFormat('[O]', '[+0800]');
20: var_dump($dt->getOffset());
21:
22: $dt = DateTime::createFromFormat('[P]', '[+08:00]');
23: var_dump($dt->getOffset());
24:
25: $dt = DateTime::createFromFormat('[O]', '[-0800]');
26: var_dump($dt->getOffset());
27:
28: $dt = DateTime::createFromFormat('[P]', '[-08:00]');
29: var_dump($dt->getOffset());
30:
31: $dt = DateTime::createFromFormat('O', 'GMT+0800');
32: var_dump($dt->getOffset());
33:
34: $dt = DateTime::createFromFormat('P', 'GMT+08:00');
35: var_dump($dt->getOffset());
36:
37: $dt = DateTime::createFromFormat('O', 'GMT-0800');
38: var_dump($dt->getOffset());
39:
40: $dt = DateTime::createFromFormat('P', 'GMT-08:00');
41: var_dump($dt->getOffset());
42:
43: $dt = DateTime::createFromFormat('[O]', '[GMT+0800]');
44: var_dump($dt->getOffset());
45:
46: $dt = DateTime::createFromFormat('[P]', '[GMT+08:00]');
47: var_dump($dt->getOffset());
48:
49: $dt = DateTime::createFromFormat('[O]', '[GMT-0800]');
50: var_dump($dt->getOffset());
51:
52: $dt = DateTime::createFromFormat('[P]', '[GMT-08:00]');
53: var_dump($dt->getOffset());
54:
55: $dt = DateTime::createFromFormat('O', 'invalid');
56: var_dump($dt);
57: ?>
58: --EXPECT--
59: int(28800)
60: int(28800)
61: int(-28800)
62: int(-28800)
63: int(28800)
64: int(28800)
65: int(-28800)
66: int(-28800)
67: int(28800)
68: int(28800)
69: int(-28800)
70: int(-28800)
71: int(28800)
72: int(28800)
73: int(-28800)
74: int(-28800)
75: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>