From: Ilia Alshanetsky Date: Wed, 12 Nov 2003 02:55:03 +0000 (+0000) Subject: Fixed bug #26198 (strtotime() handling of M/F Y date format). X-Git-Tag: php-5.0.0b3RC1~715 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=770a111a433207475f7778fe6bf3fa2db3b37659;p=php Fixed bug #26198 (strtotime() handling of M/F Y date format). --- diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y index 5669b0bcc9..abe77acf69 100644 --- a/ext/standard/parsedate.y +++ b/ext/standard/parsedate.y @@ -329,7 +329,11 @@ date : tUNUMBER '/' tUNUMBER { } | tMONTH tUNUMBER { ((struct date_yy *)parm)->yyMonth = $1; - ((struct date_yy *)parm)->yyDay = $2; + if ($2 > 1000) { + ((struct date_yy *)parm)->yyYear = $2; + } else { + ((struct date_yy *)parm)->yyDay = $2; + } } | tMONTH tUNUMBER ',' tUNUMBER { ((struct date_yy *)parm)->yyMonth = $1; @@ -338,7 +342,11 @@ date : tUNUMBER '/' tUNUMBER { } | tUNUMBER tMONTH { ((struct date_yy *)parm)->yyMonth = $2; - ((struct date_yy *)parm)->yyDay = $1; + if ($1 > 1000) { + ((struct date_yy *)parm)->yyYear = $1; + } else { + ((struct date_yy *)parm)->yyDay = $1; + } } | tUNUMBER tMONTH tUNUMBER { ((struct date_yy *)parm)->yyMonth = $2; diff --git a/ext/standard/tests/time/bug26198.phpt b/ext/standard/tests/time/bug26198.phpt new file mode 100644 index 0000000000..318108da78 --- /dev/null +++ b/ext/standard/tests/time/bug26198.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #26198 (strtotime handling of "M Y" and "Y M" format) +--FILE-- + +--EXPECT-- +October 2001 +Oct 2001