xref: /PHP-5.5/ext/date/tests/bug40861.phpt (revision b15cbf69)
1--TEST--
2Bug #40861 (Multiple +/- on relative units breaks strtotime())
3--FILE--
4<?php
5date_default_timezone_set("GMT");
6
7$offset = +60;
8$ts = strtotime('2000-01-01 12:00:00');
9$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
10echo $result . "\n";
11
12$offset = -60;
13$ts = strtotime('2000-01-01 12:00:00');
14$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
15echo $result . "\n";
16
17$offset = -60;
18$ts = strtotime('2000-01-01 12:00:00');
19$result = date("Y-m-d H:i:s", strtotime("-$offset minutes", $ts));
20echo $result . "\n";
21
22
23$offset = 60;
24$ts = strtotime('2000-01-01 12:00:00');
25$result = date("Y-m-d H:i:s", strtotime("+$offset minutes", $ts));
26echo $result . "\n";
27
28?>
29--EXPECT--
302000-01-01 13:00:00
312000-01-01 11:00:00
322000-01-01 13:00:00
332000-01-01 13:00:00
34