Fixed bug #67109: First uppercase letter breaks date string parsing.
authorDerick Rethans <github@derickrethans.nl>
Mon, 18 Aug 2014 17:31:26 +0000 (18:31 +0100)
committerDerick Rethans <github@derickrethans.nl>
Mon, 18 Aug 2014 17:41:50 +0000 (18:41 +0100)
ext/date/lib/parse_date.c
ext/date/lib/parse_date.re
ext/date/tests/bug67109.phpt [new file with mode: 0644]

index ecfdbefff34c7994fc7146a2e48f8a38d9ae1d0c..fbc76402abbab622ef0cfef44e84c5dc44cbb487 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Aug 17 11:08:33 2014 */
+/* Generated by re2c 0.13.5 on Mon Aug 18 18:28:27 2014 */
 #line 1 "ext/date/lib/parse_date.re"
 /*
    +----------------------------------------------------------------------+
@@ -19863,7 +19863,7 @@ yy1315:
                TIMELIB_HAVE_RELATIVE();
 
                /* skip "last day of" or "first day of" */
-               if (*ptr == 'l') {
+               if (*ptr == 'l' || *ptr == 'L') {
                        s->time->relative.first_last_day_of = 2;
                } else {
                        s->time->relative.first_last_day_of = 1;
index 4cbbb554bf5701c4ac249a2640640be3a57cbd5e..c7953e75ba4d7f2a91c2245a1332f902a8ca8847 100644 (file)
@@ -1029,7 +1029,7 @@ weekdayof        = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
                TIMELIB_HAVE_RELATIVE();
 
                /* skip "last day of" or "first day of" */
-               if (*ptr == 'l') {
+               if (*ptr == 'l' || *ptr == 'L') {
                        s->time->relative.first_last_day_of = 2;
                } else {
                        s->time->relative.first_last_day_of = 1;
diff --git a/ext/date/tests/bug67109.phpt b/ext/date/tests/bug67109.phpt
new file mode 100644 (file)
index 0000000..bcdacb0
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+Bug #67109 (First uppercase letter breaks date string parsing)
+--FILE--
+<?php
+var_dump(date('d.m.Y',strtotime('last day of this month')));
+var_dump(date('d.m.Y',strtotime('Last day of this month')));
+var_dump(date('d.m.Y',strtotime('lAst Day of This Month')));
+?>
+--EXPECT--
+string(10) "31.08.2014"
+string(10) "31.08.2014"
+string(10) "31.08.2014"