iliaa Tue Nov 11 21:55:04 2003 EDT Added files: /php-src/ext/standard/tests/time bug26198.phpt
Modified files: /php-src/ext/standard parsedate.y Log: Fixed bug #26198 (strtotime() handling of M/F Y date format). Index: php-src/ext/standard/parsedate.y diff -u php-src/ext/standard/parsedate.y:1.42 php-src/ext/standard/parsedate.y:1.43 --- php-src/ext/standard/parsedate.y:1.42 Fri Sep 26 03:51:52 2003 +++ php-src/ext/standard/parsedate.y Tue Nov 11 21:55:03 2003 @@ -8,7 +8,7 @@ ** This code is in the public domain and has no copyright. */ -/* $Id: parsedate.y,v 1.42 2003/09/26 07:51:52 hholzgra Exp $ */ +/* $Id: parsedate.y,v 1.43 2003/11/12 02:55:03 iliaa Exp $ */ #include "php.h" @@ -329,7 +329,11 @@ } | 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 @@ } | 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; Index: php-src/ext/standard/tests/time/bug26198.phpt +++ php-src/ext/standard/tests/time/bug26198.phpt --TEST-- Bug #26198 (strtotime handling of "M Y" and "Y M" format) --FILE-- <?php echo date("F Y\n", strtotime("Oct 2001")); echo date("M Y\n", strtotime("2001 Oct")); ?> --EXPECT-- October 2001 Oct 2001 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php