Skip to content

Commit

Permalink
- Fixed bug #60236 (TLA timezone dates are not converted properly from
Browse files Browse the repository at this point in the history
  timestamp).
- Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with
  time zone type 2).

And fixed some test cases.
  • Loading branch information
Derick Rethans committed Nov 24, 2011
1 parent fb57346 commit 7411ae0
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 18 deletions.
8 changes: 7 additions & 1 deletion NEWS
Expand Up @@ -24,7 +24,13 @@ PHP NEWS
. Added .phar to default authorized extensions. (fat)

- BCmath:
. Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)
. Fixed bug #60377 (bcscale related crashes on 64bits platforms). (shm)

- Date:
. Fixed bug #60236 (TLA timezone dates are not converted properly from
timestamp). (Derick)
. Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with
time zone type 2). (Derick)

- EXIF:
. Fixed bug #60150 (Integer overflow during the parsing of invalid exif
Expand Down
4 changes: 2 additions & 2 deletions ext/date/lib/unixtime2tm.c
Expand Up @@ -146,7 +146,7 @@ void timelib_update_from_sse(timelib_time *tm)
int z = tm->z;
signed int dst = tm->dst;

timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60));
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + (tm->dst * 3600));

tm->z = z;
tm->dst = dst;
Expand Down Expand Up @@ -184,7 +184,7 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
int z = tm->z;
signed int dst = tm->dst;

timelib_unixtime2gmt(tm, ts - (tm->z * 60));
timelib_unixtime2gmt(tm, ts - (tm->z * 60) + (tm->dst * 3600));

tm->z = z;
tm->dst = dst;
Expand Down
4 changes: 1 addition & 3 deletions ext/date/tests/bug55253.phpt
@@ -1,9 +1,7 @@
--TEST--
DateTime::add() and sub() result -1 hour on objects with time zone type 2
Bug #55253: DateTime::add() and sub() result -1 hour on objects with time zone type 2
--CREDITS--
Daniel Convissor <danielc@php.net>
--XFAIL--
Bug 55253 exists
--FILE--
<?php

Expand Down
20 changes: 20 additions & 0 deletions ext/date/tests/bug60236.phpt
@@ -0,0 +1,20 @@
--TEST--
Bug #60236: TLA timezone dates are not converted properly from timestamp
--FILE--
<?php
$t = new DateTime('2010-07-06 18:38:28 EDT');
$ts = $t->format('U');
var_dump($ts);
$t->setTimestamp($ts);
var_dump($t);
?>
--EXPECT--
string(10) "1278455908"
object(DateTime)#1 (3) {
["date"]=>
string(19) "2010-07-06 18:38:28"
["timezone_type"]=>
int(2)
["timezone"]=>
string(3) "EDT"
}
8 changes: 4 additions & 4 deletions ext/date/tests/date_default_timezone_get-1.phpt
Expand Up @@ -9,8 +9,8 @@ date.timezone=
echo date('e'), "\n";
?>
--EXPECTF--
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-1.php on line 3
%s
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3
UTC

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-1.php on line 4
%s
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4
UTC
4 changes: 2 additions & 2 deletions ext/date/tests/date_default_timezone_get-2.phpt
Expand Up @@ -8,5 +8,5 @@ date.timezone=
echo date_default_timezone_get(), "\n";
?>
--EXPECTF--
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-2.php on line 3
%s
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-2.php on line 3
UTC
4 changes: 0 additions & 4 deletions ext/date/tests/mktime-2.phpt
@@ -1,9 +1,5 @@
--TEST--
mktime() [2]
--SKIPIF--
<?php
if(defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip mktime uses system TZ on Windows and putenv TZ is not supported on Windows at runtime");
?>
--INI--
error_reporting=2047
--FILE--
Expand Down
Expand Up @@ -2,8 +2,6 @@
RFC: DateTime and Daylight Saving Time Transitions (zone type 2)
--CREDITS--
Daniel Convissor <danielc@php.net>
--XFAIL--
RFC not implemented yet
--FILE--
<?php

Expand Down

0 comments on commit 7411ae0

Please sign in to comment.