From 799a1241ec856c69b27d4672b7ca95a5590f7a28 Mon Sep 17 00:00:00 2001 From: gron1987 Date: Wed, 28 Nov 2012 12:19:42 +0200 Subject: [PATCH 1/2] Fix DateTime, when use it with D/l in format and textual day have dot at the end --- ext/date/lib/parse_date.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 4829da6c9155c..253c482aebd4a 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -651,7 +651,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; From 28409e47b9db7aedb61de63ee63f0dc1bef2d729 Mon Sep 17 00:00:00 2001 From: gron1987 Date: Mon, 14 Jan 2013 23:36:16 +0200 Subject: [PATCH 2/2] Add test for DateTime fix --- .../tests/DateTime_fix_createFromFormat.phpt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ext/date/tests/DateTime_fix_createFromFormat.phpt diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt new file mode 100644 index 0000000000000..b85a8e6784ce9 --- /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===