From 62b0f1d0fc79d98ddf03eacb5be0d0faabd992a0 Mon Sep 17 00:00:00 2001 From: gron1987 Date: Wed, 28 Nov 2012 12:19:42 +0200 Subject: [PATCH] Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end --- ext/date/lib/parse_date.c | 5 ++-- ext/date/lib/parse_date.re | 3 +- .../tests/DateTime_fix_createFromFormat.phpt | 29 +++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 ext/date/tests/DateTime_fix_createFromFormat.phpt diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 8f70748267..d20029d5b0 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 Fri Apr 26 11:10:28 2013 */ +/* Generated by re2c 0.13.5 on Sun Aug 25 14:46:08 2013 */ #line 1 "ext/date/lib/parse_date.re" /* +----------------------------------------------------------------------+ @@ -616,7 +616,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr) char *begin = *ptr, *end; const timelib_relunit *tp, *value = NULL; - while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') { + while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' && + **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) { ++*ptr; } end = *ptr; diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index 014f6a09e2..7efeb430c3 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -614,7 +614,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr) char *begin = *ptr, *end; const timelib_relunit *tp, *value = NULL; - while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') { + while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' && + **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) { ++*ptr; } end = *ptr; diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt new file mode 100644 index 0000000000..abde292775 --- /dev/null +++ b/ext/date/tests/DateTime_fix_createFromFormat.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test fix for DateTime when date have textual day with dot or other special char at end +--FILE-- +format("D., M. j, Y g:iA") . "\n"; +echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n"; + +?> +===DONE=== +--EXPECTF-- +*** Testing clone on DateTime objects *** +Format method: Thu., Nov. 29, 2012 5:00PM +createFromFormat method: Thu., Nov. 29, 2012 5:00PM +===DONE===