cvs: php-src /ext/date/lib unixtime2tm.c /ext/date/tests bug35699.phpt
| From: | Derick Rethans | Date: | Tue, 20 Dec 2005 16:01:21 +0000 |
| Subject: | cvs: php-src /ext/date/lib unixtime2tm.c /ext/date/tests bug35699.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36084@lists.php.net to get a copy of this message | ||
derick Tue Dec 20 16:01:21 2005 EDT
Modified files:
/php-src/ext/date/lib unixtime2tm.c
/php-src/ext/date/tests bug35699.phpt
Log:
- MF51: Fixed bug #35699 (date() can't handle leap years before 1970)
http://cvs.php.net/viewcvs.cgi/php-src/ext/date/lib/unixtime2tm.c?r1=1.13&r2=1.14&diff_format=u
Index: php-src/ext/date/lib/unixtime2tm.c
diff -u php-src/ext/date/lib/unixtime2tm.c:1.13 php-src/ext/date/lib/unixtime2tm.c:1.14
--- php-src/ext/date/lib/unixtime2tm.c:1.13 Mon Dec 19 12:57:49 2005
+++ php-src/ext/date/lib/unixtime2tm.c Tue Dec 20 16:01:21 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: unixtime2tm.c,v 1.13 2005/12/19 12:57:49 derick Exp $ */
+/* $Id: unixtime2tm.c,v 1.14 2005/12/20 16:01:21 derick Exp $ */
#include "timelib.h"
@@ -93,6 +93,9 @@
DEBUG(printf("tmp_days=%lld, year=%lld\n", tmp_days, cur_year););
months = timelib_is_leap(cur_year) ? month_tab_leap : month_tab;
+ if (timelib_is_leap(cur_year) && cur_year < 1970) {
+ tmp_days--;
+ }
i = 11;
while (i > 0) {
DEBUG(printf("month=%lld (%d)\n", i, months[i]););
http://cvs.php.net/viewcvs.cgi/php-src/ext/date/tests/bug35699.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/bug35699.phpt
diff -u /dev/null php-src/ext/date/tests/bug35699.phpt:1.2
--- /dev/null Tue Dec 20 16:01:21 2005
+++ php-src/ext/date/tests/bug35699.phpt Tue Dec 20 16:01:21 2005
@@ -0,0 +1,14 @@
+--TEST--
+Bug #35699 (date() can't handle leap years before 1970)
+--FILE--
+<?php
+date_default_timezone_set("UTC");
+
+echo date(DATE_ISO8601, strtotime('1964-06-06')), "\n";
+echo date(DATE_ISO8601, strtotime('1963-06-06')), "\n";
+echo date(DATE_ISO8601, strtotime('1964-01-06')), "\n";
+?>
+--EXPECT--
+1964-06-06T00:00:00+0000
+1963-06-06T00:00:00+0000
+1964-01-06T00:00:00+0000