summaryrefslogtreecommitdiff
path: root/ext/date/tests/bug51393.phpt
blob: e3f0983ae275173b02dde2529412b1edc2ab1005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--TEST--
Bug #51393 (DateTime::createFromFormat() fails if format string contains timezone)
--INI--
date.timezone=UTC
--FILE--
<?php
$dt = DateTime::createFromFormat('O', '+0800');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('P', '+08:00');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('O', '-0800');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('P', '-08:00');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[O]', '[+0800]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[P]', '[+08:00]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[O]', '[-0800]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[P]', '[-08:00]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('O', 'GMT+0800');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('P', 'GMT+08:00');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('O', 'GMT-0800');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('P', 'GMT-08:00');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[O]', '[GMT+0800]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[P]', '[GMT+08:00]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[O]', '[GMT-0800]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('[P]', '[GMT-08:00]');
var_dump($dt->getOffset());

$dt = DateTime::createFromFormat('O', 'invalid');
var_dump($dt);
?>
--EXPECT--
int(28800)
int(28800)
int(-28800)
int(-28800)
int(28800)
int(28800)
int(-28800)
int(-28800)
int(28800)
int(28800)
int(-28800)
int(-28800)
int(28800)
int(28800)
int(-28800)
int(-28800)
bool(false)