1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 18:22:42 +01:00
Files
archived-php-src/ext/date/tests/bug73489.phpt
Derick Rethans f0519f4837 Upgrade timelib to 2017.01
This fixes:

- Fixed bug #72719 (Relative datetime format ignores weekday on sundays only).
- Fixed bug #73294 (DateTime wrong when date string is negative).
- Fixed bug #73489 (wrong timestamp when call setTimeZone multi times with UTC
  offset).
- Fixed bug #73858 (first/last day of' flag is not being reset).
- Fixed bug #73942 ($date->modify('Friday this week') doesn't return a Friday
  if $date is a Sunday).
- Fixed bug #74057 (wrong day when using "this week" in strtotime).
2017-02-12 20:17:01 +00:00

25 lines
840 B
PHP

--TEST--
Bug #73489: wrong timestamp when call setTimeZone multi times with UTC offset
--FILE--
<?php
// example 1 - Timestamp is changing
$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
var_dump($datetime->getTimestamp());
$datetime->setTimeZone(new DateTimeZone('-03:00'));
$datetime->setTimeZone(new DateTimeZone('-03:00'));
var_dump($datetime->getTimestamp());
// example 2 - Timestamp keeps if you use getTimestamp() before second setTimeZone() calls
$datetime = new DateTime('2016-11-09 20:00:00', new DateTimeZone('UTC'));
var_dump($datetime->getTimestamp());
$datetime->setTimeZone(new DateTimeZone('-03:00'));
$datetime->getTimestamp();
$datetime->setTimeZone(new DateTimeZone('-03:00'));
var_dump($datetime->getTimestamp());
?>
--EXPECT--
int(1478721600)
int(1478721600)
int(1478721600)
int(1478721600)