summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgron1987 <vlogvinskiy@cogniance.com>2012-11-28 12:19:42 +0200
committerStanislav Malyshev <stas@php.net>2013-08-25 15:09:29 -0700
commite6424d89e9419e610ea95484081b9c26b0a7c044 (patch)
treeb1d09d4a02b3e0bf7aaf2cd2e6b236242a520edd
parentb378b0b081c2c3dd4a7aa25ce4d37bad48db752e (diff)
downloadphp-git-e6424d89e9419e610ea95484081b9c26b0a7c044.tar.gz
Fix bug #65554 in DateTime, when use it with D/l in format and textual day have dot at the end
-rw-r--r--NEWS4
-rw-r--r--ext/date/lib/parse_date.c201
-rw-r--r--ext/date/lib/parse_date.re5
-rw-r--r--ext/date/tests/DateTime_fix_createFromFormat.phpt29
4 files changed, 137 insertions, 102 deletions
diff --git a/NEWS b/NEWS
index ef046fd794..093fa20626 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,10 @@ PHP NEWS
- cURL:
. Fixed bug #65458 (curl memory leak). (Adam)
+- Datetime:
+ . Fixed bug #65554 (createFromFormat broken when weekday name is followed
+ by some delimiters). (Valentin Logvinskiy, Stas).
+
- Openssl:
. Fixed bug #64802 (openssl_x509_parse fails to parse subject properly in
some cases). (Mark Jones)
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 5d43efe1e3..2ad4d31edb 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 Sep 30 20:14:42 2012 */
+/* Generated by re2c 0.13.5 on Sun Aug 25 14:46:08 2013 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -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;
@@ -871,11 +872,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
-#line 997 "ext/date/lib/parse_date.re"
+#line 998 "ext/date/lib/parse_date.re"
-#line 879 "ext/date/lib/parse_date.c"
+#line 880 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -995,7 +996,7 @@ std:
}
yy2:
YYDEBUG(2, *YYCURSOR);
-#line 1083 "ext/date/lib/parse_date.re"
+#line 1084 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -1011,7 +1012,7 @@ yy2:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 1015 "ext/date/lib/parse_date.c"
+#line 1016 "ext/date/lib/parse_date.c"
yy3:
YYDEBUG(3, *YYCURSOR);
++YYCURSOR;
@@ -1034,7 +1035,7 @@ yy3:
}
yy4:
YYDEBUG(4, *YYCURSOR);
-#line 1677 "ext/date/lib/parse_date.re"
+#line 1678 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1047,7 +1048,7 @@ yy4:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 1051 "ext/date/lib/parse_date.c"
+#line 1052 "ext/date/lib/parse_date.c"
yy5:
YYDEBUG(5, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1358,12 +1359,12 @@ yy12:
if (yych <= '9') goto yy1385;
yy13:
YYDEBUG(13, *YYCURSOR);
-#line 1772 "ext/date/lib/parse_date.re"
+#line 1773 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
-#line 1367 "ext/date/lib/parse_date.c"
+#line 1368 "ext/date/lib/parse_date.c"
yy14:
YYDEBUG(14, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2420,11 +2421,11 @@ yy49:
if (yych <= '9') goto yy55;
yy50:
YYDEBUG(50, *YYCURSOR);
-#line 1761 "ext/date/lib/parse_date.re"
+#line 1762 "ext/date/lib/parse_date.re"
{
goto std;
}
-#line 2428 "ext/date/lib/parse_date.c"
+#line 2429 "ext/date/lib/parse_date.c"
yy51:
YYDEBUG(51, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2433,12 +2434,12 @@ yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
YYDEBUG(53, *YYCURSOR);
-#line 1766 "ext/date/lib/parse_date.re"
+#line 1767 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 2442 "ext/date/lib/parse_date.c"
+#line 2443 "ext/date/lib/parse_date.c"
yy54:
YYDEBUG(54, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2825,7 +2826,7 @@ yy72:
if (yych == 's') goto yy74;
yy73:
YYDEBUG(73, *YYCURSOR);
-#line 1745 "ext/date/lib/parse_date.re"
+#line 1746 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2840,7 +2841,7 @@ yy73:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2844 "ext/date/lib/parse_date.c"
+#line 2845 "ext/date/lib/parse_date.c"
yy74:
YYDEBUG(74, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3602,7 +3603,7 @@ yy166:
}
yy167:
YYDEBUG(167, *YYCURSOR);
-#line 1608 "ext/date/lib/parse_date.re"
+#line 1609 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3619,7 +3620,7 @@ yy167:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
-#line 3623 "ext/date/lib/parse_date.c"
+#line 3624 "ext/date/lib/parse_date.c"
yy168:
YYDEBUG(168, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4139,7 +4140,7 @@ yy193:
}
yy194:
YYDEBUG(194, *YYCURSOR);
-#line 1667 "ext/date/lib/parse_date.re"
+#line 1668 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4148,7 +4149,7 @@ yy194:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 4152 "ext/date/lib/parse_date.c"
+#line 4153 "ext/date/lib/parse_date.c"
yy195:
YYDEBUG(195, *YYCURSOR);
++YYCURSOR;
@@ -4199,7 +4200,7 @@ yy198:
}
yy199:
YYDEBUG(199, *YYCURSOR);
-#line 1413 "ext/date/lib/parse_date.re"
+#line 1414 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4212,7 +4213,7 @@ yy199:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 4216 "ext/date/lib/parse_date.c"
+#line 4217 "ext/date/lib/parse_date.c"
yy200:
YYDEBUG(200, *YYCURSOR);
yyaccept = 6;
@@ -4481,7 +4482,7 @@ yy222:
}
yy223:
YYDEBUG(223, *YYCURSOR);
-#line 1715 "ext/date/lib/parse_date.re"
+#line 1716 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4510,7 +4511,7 @@ yy223:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 4514 "ext/date/lib/parse_date.c"
+#line 4515 "ext/date/lib/parse_date.c"
yy224:
YYDEBUG(224, *YYCURSOR);
yyaccept = 7;
@@ -5208,7 +5209,7 @@ yy278:
YYDEBUG(278, *YYCURSOR);
++YYCURSOR;
YYDEBUG(279, *YYCURSOR);
-#line 1691 "ext/date/lib/parse_date.re"
+#line 1692 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5231,7 +5232,7 @@ yy278:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 5235 "ext/date/lib/parse_date.c"
+#line 5236 "ext/date/lib/parse_date.c"
yy280:
YYDEBUG(280, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5409,7 +5410,7 @@ yy294:
++YYCURSOR;
yy295:
YYDEBUG(295, *YYCURSOR);
-#line 1385 "ext/date/lib/parse_date.re"
+#line 1386 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5422,7 +5423,7 @@ yy295:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 5426 "ext/date/lib/parse_date.c"
+#line 5427 "ext/date/lib/parse_date.c"
yy296:
YYDEBUG(296, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6642,7 +6643,7 @@ yy362:
if (yych <= '9') goto yy365;
yy364:
YYDEBUG(364, *YYCURSOR);
-#line 1529 "ext/date/lib/parse_date.re"
+#line 1530 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6655,7 +6656,7 @@ yy364:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 6659 "ext/date/lib/parse_date.c"
+#line 6660 "ext/date/lib/parse_date.c"
yy365:
YYDEBUG(365, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7293,7 +7294,7 @@ yy392:
}
yy393:
YYDEBUG(393, *YYCURSOR);
-#line 1587 "ext/date/lib/parse_date.re"
+#line 1588 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7313,7 +7314,7 @@ yy393:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 7317 "ext/date/lib/parse_date.c"
+#line 7318 "ext/date/lib/parse_date.c"
yy394:
YYDEBUG(394, *YYCURSOR);
yyaccept = 5;
@@ -9063,7 +9064,7 @@ yy454:
++YYCURSOR;
yy455:
YYDEBUG(455, *YYCURSOR);
-#line 1290 "ext/date/lib/parse_date.re"
+#line 1291 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -9074,7 +9075,7 @@ yy455:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 9078 "ext/date/lib/parse_date.c"
+#line 9079 "ext/date/lib/parse_date.c"
yy456:
YYDEBUG(456, *YYCURSOR);
yyaccept = 0;
@@ -9634,7 +9635,7 @@ yy475:
}
yy476:
YYDEBUG(476, *YYCURSOR);
-#line 1427 "ext/date/lib/parse_date.re"
+#line 1428 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9645,7 +9646,7 @@ yy476:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 9649 "ext/date/lib/parse_date.c"
+#line 9650 "ext/date/lib/parse_date.c"
yy477:
YYDEBUG(477, *YYCURSOR);
yyaccept = 10;
@@ -9786,7 +9787,7 @@ yy488:
YYDEBUG(488, *YYCURSOR);
++YYCURSOR;
YYDEBUG(489, *YYCURSOR);
-#line 1145 "ext/date/lib/parse_date.re"
+#line 1146 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9802,7 +9803,7 @@ yy488:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 9806 "ext/date/lib/parse_date.c"
+#line 9807 "ext/date/lib/parse_date.c"
yy490:
YYDEBUG(490, *YYCURSOR);
yyaccept = 11;
@@ -9815,7 +9816,7 @@ yy490:
}
yy491:
YYDEBUG(491, *YYCURSOR);
-#line 1182 "ext/date/lib/parse_date.re"
+#line 1183 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9840,7 +9841,7 @@ yy491:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 9844 "ext/date/lib/parse_date.c"
+#line 9845 "ext/date/lib/parse_date.c"
yy492:
YYDEBUG(492, *YYCURSOR);
yyaccept = 11;
@@ -10150,7 +10151,7 @@ yy523:
YYDEBUG(523, *YYCURSOR);
++YYCURSOR;
YYDEBUG(524, *YYCURSOR);
-#line 1162 "ext/date/lib/parse_date.re"
+#line 1163 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10169,7 +10170,7 @@ yy523:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 10173 "ext/date/lib/parse_date.c"
+#line 10174 "ext/date/lib/parse_date.c"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 11;
@@ -10275,7 +10276,7 @@ yy534:
if (yych <= '9') goto yy541;
yy535:
YYDEBUG(535, *YYCURSOR);
-#line 1344 "ext/date/lib/parse_date.re"
+#line 1345 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10289,7 +10290,7 @@ yy535:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 10293 "ext/date/lib/parse_date.c"
+#line 10294 "ext/date/lib/parse_date.c"
yy536:
YYDEBUG(536, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11026,7 +11027,7 @@ yy605:
YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
YYDEBUG(607, *YYCURSOR);
-#line 1359 "ext/date/lib/parse_date.re"
+#line 1360 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11037,7 +11038,7 @@ yy605:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 11041 "ext/date/lib/parse_date.c"
+#line 11042 "ext/date/lib/parse_date.c"
yy608:
YYDEBUG(608, *YYCURSOR);
yyaccept = 11;
@@ -11073,7 +11074,7 @@ yy611:
if (yych <= '9') goto yy605;
yy612:
YYDEBUG(612, *YYCURSOR);
-#line 1371 "ext/date/lib/parse_date.re"
+#line 1372 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11086,7 +11087,7 @@ yy612:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 11090 "ext/date/lib/parse_date.c"
+#line 11091 "ext/date/lib/parse_date.c"
yy613:
YYDEBUG(613, *YYCURSOR);
yyaccept = 11;
@@ -11727,7 +11728,7 @@ yy656:
}
yy657:
YYDEBUG(657, *YYCURSOR);
-#line 1330 "ext/date/lib/parse_date.re"
+#line 1331 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11740,7 +11741,7 @@ yy657:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 11744 "ext/date/lib/parse_date.c"
+#line 11745 "ext/date/lib/parse_date.c"
yy658:
YYDEBUG(658, *YYCURSOR);
yyaccept = 13;
@@ -11846,7 +11847,7 @@ yy666:
}
yy667:
YYDEBUG(667, *YYCURSOR);
-#line 1274 "ext/date/lib/parse_date.re"
+#line 1275 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11861,7 +11862,7 @@ yy667:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 11865 "ext/date/lib/parse_date.c"
+#line 11866 "ext/date/lib/parse_date.c"
yy668:
YYDEBUG(668, *YYCURSOR);
yyaccept = 14;
@@ -12094,7 +12095,7 @@ yy700:
if (yych <= ':') goto yy704;
yy701:
YYDEBUG(701, *YYCURSOR);
-#line 1557 "ext/date/lib/parse_date.re"
+#line 1558 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12114,7 +12115,7 @@ yy701:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 12118 "ext/date/lib/parse_date.c"
+#line 12119 "ext/date/lib/parse_date.c"
yy702:
YYDEBUG(702, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12666,7 +12667,7 @@ yy763:
}
yy764:
YYDEBUG(764, *YYCURSOR);
-#line 1302 "ext/date/lib/parse_date.re"
+#line 1303 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12679,7 +12680,7 @@ yy764:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 12683 "ext/date/lib/parse_date.c"
+#line 12684 "ext/date/lib/parse_date.c"
yy765:
YYDEBUG(765, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12718,7 +12719,7 @@ yy771:
YYDEBUG(771, *YYCURSOR);
++YYCURSOR;
YYDEBUG(772, *YYCURSOR);
-#line 1543 "ext/date/lib/parse_date.re"
+#line 1544 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12731,7 +12732,7 @@ yy771:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 12735 "ext/date/lib/parse_date.c"
+#line 12736 "ext/date/lib/parse_date.c"
yy773:
YYDEBUG(773, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12869,7 +12870,7 @@ yy783:
}
yy784:
YYDEBUG(784, *YYCURSOR);
-#line 1578 "ext/date/lib/parse_date.re"
+#line 1579 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12877,7 +12878,7 @@ yy784:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 12881 "ext/date/lib/parse_date.c"
+#line 12882 "ext/date/lib/parse_date.c"
yy785:
YYDEBUG(785, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13028,7 +13029,7 @@ yy793:
}
yy794:
YYDEBUG(794, *YYCURSOR);
-#line 1399 "ext/date/lib/parse_date.re"
+#line 1400 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13041,7 +13042,7 @@ yy794:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 13045 "ext/date/lib/parse_date.c"
+#line 13046 "ext/date/lib/parse_date.c"
yy795:
YYDEBUG(795, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13256,7 +13257,7 @@ yy814:
if (yych <= '7') goto yy817;
yy815:
YYDEBUG(815, *YYCURSOR);
-#line 1510 "ext/date/lib/parse_date.re"
+#line 1511 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13274,7 +13275,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 13278 "ext/date/lib/parse_date.c"
+#line 13279 "ext/date/lib/parse_date.c"
yy816:
YYDEBUG(816, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13284,7 +13285,7 @@ yy817:
YYDEBUG(817, *YYCURSOR);
++YYCURSOR;
YYDEBUG(818, *YYCURSOR);
-#line 1491 "ext/date/lib/parse_date.re"
+#line 1492 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13302,7 +13303,7 @@ yy817:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 13306 "ext/date/lib/parse_date.c"
+#line 13307 "ext/date/lib/parse_date.c"
yy819:
YYDEBUG(819, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13366,7 +13367,7 @@ yy821:
}
yy822:
YYDEBUG(822, *YYCURSOR);
-#line 1477 "ext/date/lib/parse_date.re"
+#line 1478 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13379,7 +13380,7 @@ yy822:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 13383 "ext/date/lib/parse_date.c"
+#line 13384 "ext/date/lib/parse_date.c"
yy823:
YYDEBUG(823, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13482,7 +13483,7 @@ yy842:
++YYCURSOR;
yy843:
YYDEBUG(843, *YYCURSOR);
-#line 1451 "ext/date/lib/parse_date.re"
+#line 1452 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13507,7 +13508,7 @@ yy843:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 13511 "ext/date/lib/parse_date.c"
+#line 13512 "ext/date/lib/parse_date.c"
yy844:
YYDEBUG(844, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13769,7 +13770,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
-#line 1439 "ext/date/lib/parse_date.re"
+#line 1440 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -13780,7 +13781,7 @@ yy849:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 13784 "ext/date/lib/parse_date.c"
+#line 13785 "ext/date/lib/parse_date.c"
yy850:
YYDEBUG(850, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14700,7 +14701,7 @@ yy973:
if (yych <= '9') goto yy996;
yy974:
YYDEBUG(974, *YYCURSOR);
-#line 1316 "ext/date/lib/parse_date.re"
+#line 1317 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14713,7 +14714,7 @@ yy974:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 14717 "ext/date/lib/parse_date.c"
+#line 14718 "ext/date/lib/parse_date.c"
yy975:
YYDEBUG(975, *YYCURSOR);
yyaccept = 22;
@@ -15722,7 +15723,7 @@ yy1066:
}
yy1068:
YYDEBUG(1068, *YYCURSOR);
-#line 1208 "ext/date/lib/parse_date.re"
+#line 1209 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15744,7 +15745,7 @@ yy1068:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 15748 "ext/date/lib/parse_date.c"
+#line 15749 "ext/date/lib/parse_date.c"
yy1069:
YYDEBUG(1069, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15836,7 +15837,7 @@ yy1075:
}
yy1076:
YYDEBUG(1076, *YYCURSOR);
-#line 1254 "ext/date/lib/parse_date.re"
+#line 1255 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -15855,7 +15856,7 @@ yy1076:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 15859 "ext/date/lib/parse_date.c"
+#line 15860 "ext/date/lib/parse_date.c"
yy1077:
YYDEBUG(1077, *YYCURSOR);
yyaccept = 25;
@@ -16753,7 +16754,7 @@ yy1117:
}
yy1118:
YYDEBUG(1118, *YYCURSOR);
-#line 1650 "ext/date/lib/parse_date.re"
+#line 1651 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16769,7 +16770,7 @@ yy1118:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16773 "ext/date/lib/parse_date.c"
+#line 16774 "ext/date/lib/parse_date.c"
yy1119:
YYDEBUG(1119, *YYCURSOR);
++YYCURSOR;
@@ -16820,7 +16821,7 @@ yy1126:
YYDEBUG(1126, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1127, *YYCURSOR);
-#line 1123 "ext/date/lib/parse_date.re"
+#line 1124 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16841,7 +16842,7 @@ yy1126:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
-#line 16845 "ext/date/lib/parse_date.c"
+#line 16846 "ext/date/lib/parse_date.c"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yyaccept = 26;
@@ -16949,7 +16950,7 @@ yy1141:
}
yy1142:
YYDEBUG(1142, *YYCURSOR);
-#line 1626 "ext/date/lib/parse_date.re"
+#line 1627 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16972,7 +16973,7 @@ yy1142:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 16976 "ext/date/lib/parse_date.c"
+#line 16977 "ext/date/lib/parse_date.c"
yy1143:
YYDEBUG(1143, *YYCURSOR);
yych = *++YYCURSOR;
@@ -19649,7 +19650,7 @@ yy1294:
goto yy1298;
yy1295:
YYDEBUG(1295, *YYCURSOR);
-#line 1100 "ext/date/lib/parse_date.re"
+#line 1101 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -19671,7 +19672,7 @@ yy1295:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
-#line 19675 "ext/date/lib/parse_date.c"
+#line 19676 "ext/date/lib/parse_date.c"
yy1296:
YYDEBUG(1296, *YYCURSOR);
yyaccept = 28;
@@ -21362,7 +21363,7 @@ yy1385:
if (yych <= '9') goto yy1385;
yy1387:
YYDEBUG(1387, *YYCURSOR);
-#line 1057 "ext/date/lib/parse_date.re"
+#line 1058 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -21387,7 +21388,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21391 "ext/date/lib/parse_date.c"
+#line 21392 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21823,7 +21824,7 @@ yy1416:
++YYCURSOR;
yy1417:
YYDEBUG(1417, *YYCURSOR);
-#line 1045 "ext/date/lib/parse_date.re"
+#line 1046 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -21834,7 +21835,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21838 "ext/date/lib/parse_date.c"
+#line 21839 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21869,7 +21870,7 @@ yy1419:
}
yy1420:
YYDEBUG(1420, *YYCURSOR);
-#line 1035 "ext/date/lib/parse_date.re"
+#line 1036 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -21878,7 +21879,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21882 "ext/date/lib/parse_date.c"
+#line 21883 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23890,7 +23891,7 @@ yy1499:
}
yy1500:
YYDEBUG(1500, *YYCURSOR);
-#line 1014 "ext/date/lib/parse_date.re"
+#line 1015 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -23898,7 +23899,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 23902 "ext/date/lib/parse_date.c"
+#line 23903 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24037,7 +24038,7 @@ yy1507:
}
yy1508:
YYDEBUG(1508, *YYCURSOR);
-#line 1023 "ext/date/lib/parse_date.re"
+#line 1024 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -24048,7 +24049,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24052 "ext/date/lib/parse_date.c"
+#line 24053 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@@ -24581,7 +24582,7 @@ yy1530:
++YYCURSOR;
yy1531:
YYDEBUG(1531, *YYCURSOR);
-#line 1002 "ext/date/lib/parse_date.re"
+#line 1003 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -24592,7 +24593,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24596 "ext/date/lib/parse_date.c"
+#line 24597 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@@ -24765,7 +24766,7 @@ yy1537:
goto yy1531;
}
}
-#line 1776 "ext/date/lib/parse_date.re"
+#line 1777 "ext/date/lib/parse_date.re"
}
@@ -25123,7 +25124,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
- *fptr++;
+ fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 8e1972d99f..f874682ce6 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -649,7 +649,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;
@@ -2130,7 +2131,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
break;
case '\\': /* escaped char */
- *fptr++;
+ fptr++;
if (*ptr == *fptr) {
++ptr;
} else {
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--
+<?php
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+// Create a DateTime object..
+$orig = new DateTime('2012-11-29 17:00:00');
+
+// String to parse
+$string = "Thu., Nov. 29, 2012 5:00PM";
+
+// Create a DateTime object from format
+$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
+
+echo "Format method: " . $orig->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===