source: src/router/php7/ext/date/tests/bug73489.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 840 bytes
Line 
1--TEST--
2Bug #73489: wrong timestamp when call setTimeZone multi times with UTC offset
3--FILE--
4<?php
5// example 1 - Timestamp is changing
6$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
7var_dump($datetime->getTimestamp());
8$datetime->setTimeZone(new DateTimeZone('-03:00'));
9$datetime->setTimeZone(new DateTimeZone('-03:00'));
10var_dump($datetime->getTimestamp());
11
12// example 2 - Timestamp keeps if you use getTimestamp() before second setTimeZone() calls
13$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
14var_dump($datetime->getTimestamp());
15$datetime->setTimeZone(new DateTimeZone('-03:00'));
16$datetime->getTimestamp();
17$datetime->setTimeZone(new DateTimeZone('-03:00'));
18var_dump($datetime->getTimestamp());
19?>
20--EXPECT--
21int(1478721600)
22int(1478721600)
23int(1478721600)
24int(1478721600)
Note: See TracBrowser for help on using the repository browser.