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

index 2d7a1e22719789b4c711b7123224d22114a710a1..5a6e9de8246b569923025f631d99dd59f1bfb77a 100644 (file)
@@ -967,7 +967,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 7e9aa62d93968f5f4b65d7ef753413c95d1c4e48..d02caf644ceb8edd996ba30fb183c9bafdc14d09 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