From: Ilia Alshanetsky Date: Mon, 28 Jul 2003 04:01:32 +0000 (+0000) Subject: Fixed bug #13142 (strtotime not handling "M d H:i:s Y" format) X-Git-Tag: BEFORE_ARG_INFO~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f9cf39bd30c33e074bdc3577d0aca97b5b0efd97;p=php Fixed bug #13142 (strtotime not handling "M d H:i:s Y" format) --- diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y index 28ba0cd401..6fe1fb1b13 100644 --- a/ext/standard/parsedate.y +++ b/ext/standard/parsedate.y @@ -260,6 +260,17 @@ date : tUNUMBER '/' tUNUMBER { ((struct date_yy *)parm)->yyMonth = $1; ((struct date_yy *)parm)->yyDay = $3; } + | tMONTH tUNUMBER tUNUMBER ':' tUNUMBER ':' tUNUMBER tUNUMBER { + ((struct date_yy *)parm)->yyYear = $8; + ((struct date_yy *)parm)->yyMonth = $1; + ((struct date_yy *)parm)->yyDay = $2; + + ((struct date_yy *)parm)->yyHour = $3; + ((struct date_yy *)parm)->yyMinutes = $5; + ((struct date_yy *)parm)->yySeconds = $7; + + ((struct date_yy *)parm)->yyHaveTime = 1; + } | tUNUMBER '/' tUNUMBER '/' tUNUMBER { /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY. The goal in recognizing YYYY/MM/DD is solely to support legacy diff --git a/ext/standard/tests/time/bug13142.phpt b/ext/standard/tests/time/bug13142.phpt new file mode 100644 index 0000000000..6e2bf87d31 --- /dev/null +++ b/ext/standard/tests/time/bug13142.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #13142 strtotime handling of "M d H:i:s Y" format +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Tue, 4 Sep 2001 16:39:45 -0400 +Tue, 4 Sep 2001 16:39:45 -0400