summaryrefslogtreecommitdiff
path: root/ext/date/tests/bug40861.phpt
blob: d4ef96198c7ff71eb28c70e2da04db7893f3181f (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
--TEST--
Bug #40861 (Multiple +/- on relative units breaks strtotime())
--FILE--
<?php
date_default_timezone_set("GMT");

$offset = +60;
$ts = strtotime('2000-01-01 12:00:00');
$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
echo $result . "\n";

$offset = -60;
$ts = strtotime('2000-01-01 12:00:00');
$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
echo $result . "\n";

$offset = -60;
$ts = strtotime('2000-01-01 12:00:00');
$result = date("Y-m-d H:i:s", strtotime("-$offset minutes", $ts));
echo $result . "\n";


$offset = 60;
$ts = strtotime('2000-01-01 12:00:00');
$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
echo $result . "\n";

?>
--EXPECT--
2000-01-01 13:00:00
2000-01-01 11:00:00
2000-01-01 13:00:00
2000-01-01 13:00:00