summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-05 17:27:02 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-05 17:27:02 +0000
commit937e9f801d22c6542c2ab22e3c0b5c2dcce5fc17 (patch)
tree62f0c30b61ab39f29973282f2d11e9311345d371
parent4ce11c2a6388ac2e780ede89637a39b99386d071 (diff)
downloadphp-git-937e9f801d22c6542c2ab22e3c0b5c2dcce5fc17.tar.gz
Fixed bug #35558 (mktime() interpreting 3 digit years incorrectly).
-rw-r--r--NEWS1
-rw-r--r--ext/date/php_date.c2
-rw-r--r--ext/date/tests/mktime-3.phpt4
3 files changed, 5 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 76ffb98756..3df4c670ef 100644
--- 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)
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index e27ebf1d58..0ca617b719 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -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;
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index d4ccfbabe4..0d19074fc3 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