]> granicus.if.org Git - php/commitdiff
Fixed bug #35558 (mktime() interpreting 3 digit years incorrectly).
authorIlia Alshanetsky <iliaa@php.net>
Mon, 5 Dec 2005 17:27:02 +0000 (17:27 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 5 Dec 2005 17:27:02 +0000 (17:27 +0000)
NEWS
ext/date/php_date.c
ext/date/tests/mktime-3.phpt

diff --git a/NEWS b/NEWS
index 76ffb98756d1ede7830121837306d743a1071289..3df4c670ef472427aaffee4516e6728da419cc13 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ PHP                                                                        NEWS
 - Fixed many bugs in OCI8. (Tony)
 - Fixed crash and leak in mysqli when using 4.1.x client libraries and
   connecting to 5.x server. (Andrey)
+- Fixed bug #35558 (mktime() interpreting 3 digit years incorrectly). (Ilia)
 - Fixed bug #35543 (php crash when calling non existing method of a class
   that extends PDO). (Tony)
 - Fixed bug #35539 (typo in error message for ErrorException). (Tony)
index e27ebf1d587e21f5602a259a8f990f607479f09d..0ca617b7199c0f76e92d8c4e1310dea225552cec 100644 (file)
@@ -860,7 +860,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
                case 6:
                        if (yea >= 0 && yea < 70) {
                                yea += 2000;
-                       } else if (yea >= 70 && yea <= 100) {
+                       } else if (yea >= 70 && yea <= 110) {
                                yea += 1900;
                        }
                        now->y = yea;
index d4ccfbabe4737009bedf56a4d0db89f2c9bd961e..0d19074fc3118482e86f2c28a3dc8c7da9cfa472 100644 (file)
@@ -5,7 +5,7 @@ error_reporting=2047
 --FILE--
 <?php
 $tzs = array("America/Toronto", "Europe/Oslo");
-$years = array(0, 69, 70, 71, 99, 100, 1900, 1901, 1902, 1999, 2000, 2001);
+$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001);
 
 foreach ($tzs as $tz) {
        echo $tz, "\n";
@@ -30,6 +30,7 @@ Y:   70 - January 1970-01-01T01:01:01-0500
 Y:   71 - January 1971-01-01T01:01:01-0500
 Y:   99 - January 1999-01-01T01:01:01-0500
 Y:  100 - January 2000-01-01T01:01:01-0500
+Y:  105 - January 2005-01-01T01:01:01-0500
 Y: 1900 - out of range
 Y: 1901 - out of range
 Y: 1902 - January 1902-01-01T01:01:01-0500
@@ -44,6 +45,7 @@ Y:   70 - January 1970-01-01T01:01:01+0100
 Y:   71 - January 1971-01-01T01:01:01+0100
 Y:   99 - January 1999-01-01T01:01:01+0100
 Y:  100 - January 2000-01-01T01:01:01+0100
+Y:  105 - January 2005-01-01T01:01:01+0100
 Y: 1900 - out of range
 Y: 1901 - out of range
 Y: 1902 - January 1902-01-01T01:01:01+0100