com php-src: Fixed bug #67109: First uppercase letter breaks date string parsing.: ext/date/lib/parse_date.c ext/date/lib/parse_ date.re
ext/date/tests/bug67109.phpt
| From: | Derick Rethans | Date: | Mon, 18 Aug 2014 17:41:50 +0000 |
| Subject: | com php-src: Fixed bug #67109: First uppercase letter breaks date string parsing.: ext/date/lib/parse_date.c ext/date/lib/parse_ date.re ext/date/tests/bug67109.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80587@lists.php.net to get a copy of this message | ||
Commit: 36d05d75c8d4db6d540dd7ac7cf80a4031f6ca40
Author: Derick Rethans <github@derickrethans.nl> Mon, 18 Aug 2014 18:31:26 +0100
Parents: 2b9af967fbf12d9eb5fd74a7d6d31431307b0870
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=36d05d75c8d4db6d540dd7ac7cf80a4031f6ca40
Log:
Fixed bug #67109: First uppercase letter breaks date string parsing.
Bugs:
https://bugs.php.net/67109
Changed paths:
M ext/date/lib/parse_date.c
M ext/date/lib/parse_date.re
A ext/date/tests/bug67109.phpt
Diff:
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date..c
index ecfdbef..fbc7640 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -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;
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 4cbbb55..c7953e7 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -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
index 0000000..bcdacb0
--- /dev/null
+++ b/ext/date/tests/bug67109.phpt
@@ -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"