summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-05 17:27:24 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-05 17:27:24 +0000
commitf30dbd9f54df4827bcc4631da968111923d74c79 (patch)
tree580adba50353c983a537aa4b164106be7ebcb62b
parent43536d38e68083d0fb2cca7bb3aba02fb725778f (diff)
downloadphp-git-f30dbd9f54df4827bcc4631da968111923d74c79.tar.gz
MFB51: Fixed bug #35558 (mktime() interpreting 3 digit years incorrectly).
-rw-r--r--ext/date/php_date.c2
-rw-r--r--ext/date/tests/mktime-3.phpt4
2 files changed, 4 insertions, 2 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 2d7a1e2271..5a6e9de824 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -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;
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index 7e9aa62d93..d02caf644c 100644
--- a/ext/date/tests/mktime-3.phpt
+++ b/ext/date/tests/mktime-3.phpt
@@ -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