]> granicus.if.org Git - php/commitdiff
- Fixed bug #60236 (TLA timezone dates are not converted properly from
authorDerick Rethans <derick@php.net>
Thu, 24 Nov 2011 17:13:47 +0000 (17:13 +0000)
committerDerick Rethans <derick@php.net>
Thu, 24 Nov 2011 17:13:47 +0000 (17:13 +0000)
  timestamp).
- Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with
  time zone type 2).

And fixed some test cases.

NEWS
ext/date/lib/unixtime2tm.c
ext/date/tests/bug55253.phpt
ext/date/tests/bug60236.phpt [new file with mode: 0644]
ext/date/tests/date_default_timezone_get-1.phpt
ext/date/tests/date_default_timezone_get-2.phpt
ext/date/tests/mktime-2.phpt
ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt

diff --git a/NEWS b/NEWS
index c646136c226171dfcf5d62fe80a6ebacca2d8dec..39373d9d40e17ec81cfb2ab4b3446e1f5420ffb8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
index 871fa2f5e515e9df4723e9f957b282f1a5fea00e..a76fa80991ebfcda18bfe207316cedf0323edc13 100644 (file)
@@ -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;
@@ -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;
index 3c0efc4691dd3bcc7ec3bbd5b5942de2621c6583..3b2b42bc2622a1c6438f2067ddb2145d3a0d0d08 100755 (executable)
@@ -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
 
diff --git a/ext/date/tests/bug60236.phpt b/ext/date/tests/bug60236.phpt
new file mode 100644 (file)
index 0000000..b2bb62b
--- /dev/null
@@ -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"
+}
index d8d95a03651b79050e67b631d9cd95d9dc8d5faf..383394a955a73cc23f47ba780ad1b88314e56a1a 100644 (file)
@@ -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
index bdef81b38d6b05892789d077d20f1a320b36a796..11bd3070a0eb9c1af3768e86a1315e26b89a6a85 100644 (file)
@@ -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
index 5ba6bd6c16151d61b6ad80c8573329d09f5ddb21..aa259b577cab70ff04d7cffaf421f00a4ab7ad22 100644 (file)
@@ -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--
index 5813602513624157d7775ee5baf5cf78537dcb16..72585125ea6d8548248a72731b55af76563ddffe 100644 (file)
@@ -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