derick                                   Thu, 24 Nov 2011 17:13:47 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=319767

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

And fixed some test cases.

Bugs: https://bugs.php.net/60236 (Assigned) TLA timezone dates are not 
converted properly from timestamp
      https://bugs.php.net/55253 (Open) DateTime::add() and sub() result -1 
hour on objects with time zone type 2
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/date/lib/unixtime2tm.c
    U   php/php-src/branches/PHP_5_3/ext/date/tests/bug55253.phpt
    A   php/php-src/branches/PHP_5_3/ext/date/tests/bug60236.phpt
    U   
php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-1.phpt
    U   
php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-2.phpt
    U   php/php-src/branches/PHP_5_3/ext/date/tests/mktime-2.phpt
    U   
php/php-src/branches/PHP_5_3/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
    U   php/php-src/branches/PHP_5_4/ext/date/lib/unixtime2tm.c
    U   php/php-src/branches/PHP_5_4/ext/date/tests/bug55253.phpt
    A   php/php-src/branches/PHP_5_4/ext/date/tests/bug60236.phpt
    U   
php/php-src/branches/PHP_5_4/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
    U   php/php-src/trunk/ext/date/lib/unixtime2tm.c
    U   php/php-src/trunk/ext/date/tests/bug55253.phpt
    A   php/php-src/trunk/ext/date/tests/bug60236.phpt
    U   
php/php-src/trunk/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/NEWS	2011-11-24 17:13:47 UTC (rev 319767)
@@ -24,8 +24,14 @@
   . 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
     header). (Stas, flolechaud at gmail dot com)

Modified: php/php-src/branches/PHP_5_3/ext/date/lib/unixtime2tm.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/lib/unixtime2tm.c	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/ext/date/lib/unixtime2tm.c	2011-11-24 17:13:47 UTC (rev 319767)
@@ -146,7 +146,7 @@
 			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 @@
 			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;

Modified: php/php-src/branches/PHP_5_3/ext/date/tests/bug55253.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/bug55253.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/bug55253.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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 <dani...@php.net>
---XFAIL--
-Bug 55253 exists
 --FILE--
 <?php


Added: php/php-src/branches/PHP_5_3/ext/date/tests/bug60236.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/bug60236.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/bug60236.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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"
+}

Modified: php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-1.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-1.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-1.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -9,8 +9,8 @@
 	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

Modified: php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-2.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/date_default_timezone_get-2.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -8,5 +8,5 @@
 	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

Modified: php/php-src/branches/PHP_5_3/ext/date/tests/mktime-2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/mktime-2.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/mktime-2.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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--

Modified: php/php-src/branches/PHP_5_3/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -2,8 +2,6 @@
 RFC: DateTime and Daylight Saving Time Transitions (zone type 2)
 --CREDITS--
 Daniel Convissor <dani...@php.net>
---XFAIL--
-RFC not implemented yet
 --FILE--
 <?php


Modified: php/php-src/branches/PHP_5_4/ext/date/lib/unixtime2tm.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/date/lib/unixtime2tm.c	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_4/ext/date/lib/unixtime2tm.c	2011-11-24 17:13:47 UTC (rev 319767)
@@ -146,7 +146,7 @@
 			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 @@
 			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;

Modified: php/php-src/branches/PHP_5_4/ext/date/tests/bug55253.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/date/tests/bug55253.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_4/ext/date/tests/bug55253.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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 <dani...@php.net>
---XFAIL--
-Bug 55253 exists
 --FILE--
 <?php


Added: php/php-src/branches/PHP_5_4/ext/date/tests/bug60236.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/date/tests/bug60236.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/date/tests/bug60236.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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"
+}

Modified: php/php-src/branches/PHP_5_4/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/branches/PHP_5_4/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -2,8 +2,6 @@
 RFC: DateTime and Daylight Saving Time Transitions (zone type 2)
 --CREDITS--
 Daniel Convissor <dani...@php.net>
---XFAIL--
-RFC not implemented yet
 --FILE--
 <?php


Modified: php/php-src/trunk/ext/date/lib/unixtime2tm.c
===================================================================
--- php/php-src/trunk/ext/date/lib/unixtime2tm.c	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/trunk/ext/date/lib/unixtime2tm.c	2011-11-24 17:13:47 UTC (rev 319767)
@@ -146,7 +146,7 @@
 			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 @@
 			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;

Modified: php/php-src/trunk/ext/date/tests/bug55253.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug55253.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/trunk/ext/date/tests/bug55253.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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 <dani...@php.net>
---XFAIL--
-Bug 55253 exists
 --FILE--
 <?php


Added: php/php-src/trunk/ext/date/tests/bug60236.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug60236.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/date/tests/bug60236.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -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"
+}


Property changes on: php/php-src/trunk/ext/date/tests/bug60236.phpt
___________________________________________________________________
Added: svn:executable
   + *

Modified: php/php-src/trunk/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt	2011-11-24 16:39:12 UTC (rev 319766)
+++ php/php-src/trunk/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt	2011-11-24 17:13:47 UTC (rev 319767)
@@ -2,8 +2,6 @@
 RFC: DateTime and Daylight Saving Time Transitions (zone type 2)
 --CREDITS--
 Daniel Convissor <dani...@php.net>
---XFAIL--
-RFC not implemented yet
 --FILE--
 <?php

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to