xref: /php-src/ext/date/tests/bug48097.phpt (revision 63289cff)
1--TEST--
2Bug #48097 (date_timezone_set function produces wrong datetime result)
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$d = date_create( "Sun, 22 May 1955 02:00:00 +0200" );
8var_dump( $d );
9echo $d->format( DATE_ISO8601 ), "\n";
10echo $d->format( 'U' ), "\n\n";
11
12$d->setTimeZone( new DateTimeZone( 'Europe/Budapest' ) );
13var_dump( $d );
14echo $d->format( DATE_ISO8601 ), "\n\n";
15echo $d->format( 'U' ), "\n\n";
16?>
17--EXPECT--
18object(DateTime)#1 (3) {
19  ["date"]=>
20  string(26) "1955-05-22 02:00:00.000000"
21  ["timezone_type"]=>
22  int(1)
23  ["timezone"]=>
24  string(6) "+02:00"
25}
261955-05-22T02:00:00+0200
27-461203200
28
29object(DateTime)#1 (3) {
30  ["date"]=>
31  string(26) "1955-05-22 01:00:00.000000"
32  ["timezone_type"]=>
33  int(3)
34  ["timezone"]=>
35  string(15) "Europe/Budapest"
36}
371955-05-22T01:00:00+0100
38
39-461203200
40