From 770a111a433207475f7778fe6bf3fa2db3b37659 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 12 Nov 2003 02:55:03 +0000 Subject: [PATCH] Fixed bug #26198 (strtotime() handling of M/F Y date format). --- ext/standard/parsedate.y | 12 ++++++++++-- ext/standard/tests/time/bug26198.phpt | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/time/bug26198.phpt 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 -- 2.50.1