diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/date/lib/parse_date.c | 199 | ||||
-rw-r--r-- | ext/date/lib/parse_date.re | 3 | ||||
-rw-r--r-- | ext/date/tests/DateTime_fix_createFromFormat.phpt | 29 |
4 files changed, 135 insertions, 100 deletions
@@ -18,6 +18,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 8f70748267..9428ce3804 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 15:12:48 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; @@ -836,11 +837,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) std: s->tok = cursor; s->len = 0; -#line 962 "ext/date/lib/parse_date.re" +#line 963 "ext/date/lib/parse_date.re" -#line 844 "ext/date/lib/parse_date.c" +#line 845 "ext/date/lib/parse_date.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -960,7 +961,7 @@ std: } yy2: YYDEBUG(2, *YYCURSOR); -#line 1048 "ext/date/lib/parse_date.re" +#line 1049 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; @@ -976,7 +977,7 @@ yy2: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 980 "ext/date/lib/parse_date.c" +#line 981 "ext/date/lib/parse_date.c" yy3: YYDEBUG(3, *YYCURSOR); ++YYCURSOR; @@ -999,7 +1000,7 @@ yy3: } yy4: YYDEBUG(4, *YYCURSOR); -#line 1642 "ext/date/lib/parse_date.re" +#line 1643 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -1012,7 +1013,7 @@ yy4: TIMELIB_DEINIT; return TIMELIB_TIMEZONE; } -#line 1016 "ext/date/lib/parse_date.c" +#line 1017 "ext/date/lib/parse_date.c" yy5: YYDEBUG(5, *YYCURSOR); yych = *++YYCURSOR; @@ -1323,12 +1324,12 @@ yy12: if (yych <= '9') goto yy1385; yy13: YYDEBUG(13, *YYCURSOR); -#line 1737 "ext/date/lib/parse_date.re" +#line 1738 "ext/date/lib/parse_date.re" { add_error(s, "Unexpected character"); goto std; } -#line 1332 "ext/date/lib/parse_date.c" +#line 1333 "ext/date/lib/parse_date.c" yy14: YYDEBUG(14, *YYCURSOR); yych = *++YYCURSOR; @@ -2385,11 +2386,11 @@ yy49: if (yych <= '9') goto yy55; yy50: YYDEBUG(50, *YYCURSOR); -#line 1726 "ext/date/lib/parse_date.re" +#line 1727 "ext/date/lib/parse_date.re" { goto std; } -#line 2393 "ext/date/lib/parse_date.c" +#line 2394 "ext/date/lib/parse_date.c" yy51: YYDEBUG(51, *YYCURSOR); yych = *++YYCURSOR; @@ -2398,12 +2399,12 @@ yy52: YYDEBUG(52, *YYCURSOR); ++YYCURSOR; YYDEBUG(53, *YYCURSOR); -#line 1731 "ext/date/lib/parse_date.re" +#line 1732 "ext/date/lib/parse_date.re" { s->pos = cursor; s->line++; goto std; } -#line 2407 "ext/date/lib/parse_date.c" +#line 2408 "ext/date/lib/parse_date.c" yy54: YYDEBUG(54, *YYCURSOR); yych = *++YYCURSOR; @@ -2790,7 +2791,7 @@ yy72: if (yych == 's') goto yy74; yy73: YYDEBUG(73, *YYCURSOR); -#line 1710 "ext/date/lib/parse_date.re" +#line 1711 "ext/date/lib/parse_date.re" { timelib_ull i; DEBUG_OUTPUT("relative"); @@ -2805,7 +2806,7 @@ yy73: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2809 "ext/date/lib/parse_date.c" +#line 2810 "ext/date/lib/parse_date.c" yy74: YYDEBUG(74, *YYCURSOR); yych = *++YYCURSOR; @@ -3567,7 +3568,7 @@ yy166: } yy167: YYDEBUG(167, *YYCURSOR); -#line 1573 "ext/date/lib/parse_date.re" +#line 1574 "ext/date/lib/parse_date.re" { const timelib_relunit* relunit; DEBUG_OUTPUT("daytext"); @@ -3584,7 +3585,7 @@ yy167: TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 3588 "ext/date/lib/parse_date.c" +#line 3589 "ext/date/lib/parse_date.c" yy168: YYDEBUG(168, *YYCURSOR); yych = *++YYCURSOR; @@ -4104,7 +4105,7 @@ yy193: } yy194: YYDEBUG(194, *YYCURSOR); -#line 1632 "ext/date/lib/parse_date.re" +#line 1633 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("monthtext"); TIMELIB_INIT; @@ -4113,7 +4114,7 @@ yy194: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4117 "ext/date/lib/parse_date.c" +#line 4118 "ext/date/lib/parse_date.c" yy195: YYDEBUG(195, *YYCURSOR); ++YYCURSOR; @@ -4164,7 +4165,7 @@ yy198: } yy199: YYDEBUG(199, *YYCURSOR); -#line 1378 "ext/date/lib/parse_date.re" +#line 1379 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datetextual | datenoyear"); @@ -4177,7 +4178,7 @@ yy199: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4181 "ext/date/lib/parse_date.c" +#line 4182 "ext/date/lib/parse_date.c" yy200: YYDEBUG(200, *YYCURSOR); yyaccept = 6; @@ -4446,7 +4447,7 @@ yy222: } yy223: YYDEBUG(223, *YYCURSOR); -#line 1680 "ext/date/lib/parse_date.re" +#line 1681 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz"); @@ -4475,7 +4476,7 @@ yy223: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4479 "ext/date/lib/parse_date.c" +#line 4480 "ext/date/lib/parse_date.c" yy224: YYDEBUG(224, *YYCURSOR); yyaccept = 7; @@ -5173,7 +5174,7 @@ yy278: YYDEBUG(278, *YYCURSOR); ++YYCURSOR; YYDEBUG(279, *YYCURSOR); -#line 1656 "ext/date/lib/parse_date.re" +#line 1657 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12"); TIMELIB_INIT; @@ -5196,7 +5197,7 @@ yy278: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5200 "ext/date/lib/parse_date.c" +#line 5201 "ext/date/lib/parse_date.c" yy280: YYDEBUG(280, *YYCURSOR); yych = *++YYCURSOR; @@ -5374,7 +5375,7 @@ yy294: ++YYCURSOR; yy295: YYDEBUG(295, *YYCURSOR); -#line 1350 "ext/date/lib/parse_date.re" +#line 1351 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenoday"); @@ -5387,7 +5388,7 @@ yy295: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5391 "ext/date/lib/parse_date.c" +#line 5392 "ext/date/lib/parse_date.c" yy296: YYDEBUG(296, *YYCURSOR); yych = *++YYCURSOR; @@ -6607,7 +6608,7 @@ yy362: if (yych <= '9') goto yy365; yy364: YYDEBUG(364, *YYCURSOR); -#line 1494 "ext/date/lib/parse_date.re" +#line 1495 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextshort"); @@ -6620,7 +6621,7 @@ yy364: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 6624 "ext/date/lib/parse_date.c" +#line 6625 "ext/date/lib/parse_date.c" yy365: YYDEBUG(365, *YYCURSOR); yych = *++YYCURSOR; @@ -7258,7 +7259,7 @@ yy392: } yy393: YYDEBUG(393, *YYCURSOR); -#line 1552 "ext/date/lib/parse_date.re" +#line 1553 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("ago"); TIMELIB_INIT; @@ -7278,7 +7279,7 @@ yy393: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7282 "ext/date/lib/parse_date.c" +#line 7283 "ext/date/lib/parse_date.c" yy394: YYDEBUG(394, *YYCURSOR); yyaccept = 5; @@ -9028,7 +9029,7 @@ yy454: ++YYCURSOR; yy455: YYDEBUG(455, *YYCURSOR); -#line 1255 "ext/date/lib/parse_date.re" +#line 1256 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash"); TIMELIB_INIT; @@ -9039,7 +9040,7 @@ yy455: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 9043 "ext/date/lib/parse_date.c" +#line 9044 "ext/date/lib/parse_date.c" yy456: YYDEBUG(456, *YYCURSOR); yyaccept = 0; @@ -9599,7 +9600,7 @@ yy475: } yy476: YYDEBUG(476, *YYCURSOR); -#line 1392 "ext/date/lib/parse_date.re" +#line 1393 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenoyearrev"); TIMELIB_INIT; @@ -9610,7 +9611,7 @@ yy476: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 9614 "ext/date/lib/parse_date.c" +#line 9615 "ext/date/lib/parse_date.c" yy477: YYDEBUG(477, *YYCURSOR); yyaccept = 10; @@ -9751,7 +9752,7 @@ yy488: YYDEBUG(488, *YYCURSOR); ++YYCURSOR; YYDEBUG(489, *YYCURSOR); -#line 1110 "ext/date/lib/parse_date.re" +#line 1111 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12"); TIMELIB_INIT; @@ -9767,7 +9768,7 @@ yy488: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9771 "ext/date/lib/parse_date.c" +#line 9772 "ext/date/lib/parse_date.c" yy490: YYDEBUG(490, *YYCURSOR); yyaccept = 11; @@ -9780,7 +9781,7 @@ yy490: } yy491: YYDEBUG(491, *YYCURSOR); -#line 1147 "ext/date/lib/parse_date.re" +#line 1148 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long"); @@ -9805,7 +9806,7 @@ yy491: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9809 "ext/date/lib/parse_date.c" +#line 9810 "ext/date/lib/parse_date.c" yy492: YYDEBUG(492, *YYCURSOR); yyaccept = 11; @@ -10115,7 +10116,7 @@ yy523: YYDEBUG(523, *YYCURSOR); ++YYCURSOR; YYDEBUG(524, *YYCURSOR); -#line 1127 "ext/date/lib/parse_date.re" +#line 1128 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("mssqltime"); TIMELIB_INIT; @@ -10134,7 +10135,7 @@ yy523: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 10138 "ext/date/lib/parse_date.c" +#line 10139 "ext/date/lib/parse_date.c" yy525: YYDEBUG(525, *YYCURSOR); yyaccept = 11; @@ -10240,7 +10241,7 @@ yy534: if (yych <= '9') goto yy541; yy535: YYDEBUG(535, *YYCURSOR); -#line 1309 "ext/date/lib/parse_date.re" +#line 1310 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datefull"); @@ -10254,7 +10255,7 @@ yy535: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 10258 "ext/date/lib/parse_date.c" +#line 10259 "ext/date/lib/parse_date.c" yy536: YYDEBUG(536, *YYCURSOR); yych = *++YYCURSOR; @@ -10991,7 +10992,7 @@ yy605: YYDEBUG(606, *YYCURSOR); ++YYCURSOR; YYDEBUG(607, *YYCURSOR); -#line 1324 "ext/date/lib/parse_date.re" +#line 1325 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("pointed date YYYY"); TIMELIB_INIT; @@ -11002,7 +11003,7 @@ yy605: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11006 "ext/date/lib/parse_date.c" +#line 11007 "ext/date/lib/parse_date.c" yy608: YYDEBUG(608, *YYCURSOR); yyaccept = 11; @@ -11038,7 +11039,7 @@ yy611: if (yych <= '9') goto yy605; yy612: YYDEBUG(612, *YYCURSOR); -#line 1336 "ext/date/lib/parse_date.re" +#line 1337 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pointed date YY"); @@ -11051,7 +11052,7 @@ yy612: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11055 "ext/date/lib/parse_date.c" +#line 11056 "ext/date/lib/parse_date.c" yy613: YYDEBUG(613, *YYCURSOR); yyaccept = 11; @@ -11692,7 +11693,7 @@ yy656: } yy657: YYDEBUG(657, *YYCURSOR); -#line 1295 "ext/date/lib/parse_date.re" +#line 1296 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshort"); @@ -11705,7 +11706,7 @@ yy657: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11709 "ext/date/lib/parse_date.c" +#line 11710 "ext/date/lib/parse_date.c" yy658: YYDEBUG(658, *YYCURSOR); yyaccept = 13; @@ -11811,7 +11812,7 @@ yy666: } yy667: YYDEBUG(667, *YYCURSOR); -#line 1239 "ext/date/lib/parse_date.re" +#line 1240 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("americanshort | american"); @@ -11826,7 +11827,7 @@ yy667: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 11830 "ext/date/lib/parse_date.c" +#line 11831 "ext/date/lib/parse_date.c" yy668: YYDEBUG(668, *YYCURSOR); yyaccept = 14; @@ -12059,7 +12060,7 @@ yy700: if (yych <= ':') goto yy704; yy701: YYDEBUG(701, *YYCURSOR); -#line 1522 "ext/date/lib/parse_date.re" +#line 1523 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("clf"); @@ -12079,7 +12080,7 @@ yy701: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12083 "ext/date/lib/parse_date.c" +#line 12084 "ext/date/lib/parse_date.c" yy702: YYDEBUG(702, *YYCURSOR); yych = *++YYCURSOR; @@ -12631,7 +12632,7 @@ yy763: } yy764: YYDEBUG(764, *YYCURSOR); -#line 1267 "ext/date/lib/parse_date.re" +#line 1268 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("iso8601date2"); @@ -12644,7 +12645,7 @@ yy764: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12648 "ext/date/lib/parse_date.c" +#line 12649 "ext/date/lib/parse_date.c" yy765: YYDEBUG(765, *YYCURSOR); yych = *++YYCURSOR; @@ -12683,7 +12684,7 @@ yy771: YYDEBUG(771, *YYCURSOR); ++YYCURSOR; YYDEBUG(772, *YYCURSOR); -#line 1508 "ext/date/lib/parse_date.re" +#line 1509 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextreverse"); @@ -12696,7 +12697,7 @@ yy771: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 12700 "ext/date/lib/parse_date.c" +#line 12701 "ext/date/lib/parse_date.c" yy773: YYDEBUG(773, *YYCURSOR); yych = *++YYCURSOR; @@ -12834,7 +12835,7 @@ yy783: } yy784: YYDEBUG(784, *YYCURSOR); -#line 1543 "ext/date/lib/parse_date.re" +#line 1544 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("year4"); TIMELIB_INIT; @@ -12842,7 +12843,7 @@ yy784: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12846 "ext/date/lib/parse_date.c" +#line 12847 "ext/date/lib/parse_date.c" yy785: YYDEBUG(785, *YYCURSOR); yych = *++YYCURSOR; @@ -12993,7 +12994,7 @@ yy793: } yy794: YYDEBUG(794, *YYCURSOR); -#line 1364 "ext/date/lib/parse_date.re" +#line 1365 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenodayrev"); @@ -13006,7 +13007,7 @@ yy794: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 13010 "ext/date/lib/parse_date.c" +#line 13011 "ext/date/lib/parse_date.c" yy795: YYDEBUG(795, *YYCURSOR); yych = *++YYCURSOR; @@ -13221,7 +13222,7 @@ yy814: if (yych <= '7') goto yy817; yy815: YYDEBUG(815, *YYCURSOR); -#line 1475 "ext/date/lib/parse_date.re" +#line 1476 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweek"); @@ -13239,7 +13240,7 @@ yy815: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13243 "ext/date/lib/parse_date.c" +#line 13244 "ext/date/lib/parse_date.c" yy816: YYDEBUG(816, *YYCURSOR); yych = *++YYCURSOR; @@ -13249,7 +13250,7 @@ yy817: YYDEBUG(817, *YYCURSOR); ++YYCURSOR; YYDEBUG(818, *YYCURSOR); -#line 1456 "ext/date/lib/parse_date.re" +#line 1457 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweekday"); @@ -13267,7 +13268,7 @@ yy817: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13271 "ext/date/lib/parse_date.c" +#line 13272 "ext/date/lib/parse_date.c" yy819: YYDEBUG(819, *YYCURSOR); yych = *++YYCURSOR; @@ -13331,7 +13332,7 @@ yy821: } yy822: YYDEBUG(822, *YYCURSOR); -#line 1442 "ext/date/lib/parse_date.re" +#line 1443 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgydotd"); @@ -13344,7 +13345,7 @@ yy822: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 13348 "ext/date/lib/parse_date.c" +#line 13349 "ext/date/lib/parse_date.c" yy823: YYDEBUG(823, *YYCURSOR); yych = *++YYCURSOR; @@ -13447,7 +13448,7 @@ yy842: ++YYCURSOR; yy843: YYDEBUG(843, *YYCURSOR); -#line 1416 "ext/date/lib/parse_date.re" +#line 1417 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif"); @@ -13472,7 +13473,7 @@ yy843: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 13476 "ext/date/lib/parse_date.c" +#line 13477 "ext/date/lib/parse_date.c" yy844: YYDEBUG(844, *YYCURSOR); yych = *++YYCURSOR; @@ -13734,7 +13735,7 @@ yy848: } yy849: YYDEBUG(849, *YYCURSOR); -#line 1404 "ext/date/lib/parse_date.re" +#line 1405 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenocolon"); TIMELIB_INIT; @@ -13745,7 +13746,7 @@ yy849: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 13749 "ext/date/lib/parse_date.c" +#line 13750 "ext/date/lib/parse_date.c" yy850: YYDEBUG(850, *YYCURSOR); yych = *++YYCURSOR; @@ -14665,7 +14666,7 @@ yy973: if (yych <= '9') goto yy996; yy974: YYDEBUG(974, *YYCURSOR); -#line 1281 "ext/date/lib/parse_date.re" +#line 1282 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshorter"); @@ -14678,7 +14679,7 @@ yy974: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 14682 "ext/date/lib/parse_date.c" +#line 14683 "ext/date/lib/parse_date.c" yy975: YYDEBUG(975, *YYCURSOR); yyaccept = 22; @@ -15687,7 +15688,7 @@ yy1066: } yy1068: YYDEBUG(1068, *YYCURSOR); -#line 1173 "ext/date/lib/parse_date.re" +#line 1174 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("gnunocolon"); TIMELIB_INIT; @@ -15709,7 +15710,7 @@ yy1068: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 15713 "ext/date/lib/parse_date.c" +#line 15714 "ext/date/lib/parse_date.c" yy1069: YYDEBUG(1069, *YYCURSOR); yych = *++YYCURSOR; @@ -15801,7 +15802,7 @@ yy1075: } yy1076: YYDEBUG(1076, *YYCURSOR); -#line 1219 "ext/date/lib/parse_date.re" +#line 1220 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("iso8601nocolon"); @@ -15820,7 +15821,7 @@ yy1076: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 15824 "ext/date/lib/parse_date.c" +#line 15825 "ext/date/lib/parse_date.c" yy1077: YYDEBUG(1077, *YYCURSOR); yyaccept = 25; @@ -16718,7 +16719,7 @@ yy1117: } yy1118: YYDEBUG(1118, *YYCURSOR); -#line 1615 "ext/date/lib/parse_date.re" +#line 1616 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16734,7 +16735,7 @@ yy1118: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16738 "ext/date/lib/parse_date.c" +#line 16739 "ext/date/lib/parse_date.c" yy1119: YYDEBUG(1119, *YYCURSOR); ++YYCURSOR; @@ -16785,7 +16786,7 @@ yy1126: YYDEBUG(1126, *YYCURSOR); ++YYCURSOR; YYDEBUG(1127, *YYCURSOR); -#line 1088 "ext/date/lib/parse_date.re" +#line 1089 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16806,7 +16807,7 @@ yy1126: TIMELIB_DEINIT; return TIMELIB_WEEK_DAY_OF_MONTH; } -#line 16810 "ext/date/lib/parse_date.c" +#line 16811 "ext/date/lib/parse_date.c" yy1128: YYDEBUG(1128, *YYCURSOR); yyaccept = 26; @@ -16914,7 +16915,7 @@ yy1141: } yy1142: YYDEBUG(1142, *YYCURSOR); -#line 1591 "ext/date/lib/parse_date.re" +#line 1592 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16937,7 +16938,7 @@ yy1142: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16941 "ext/date/lib/parse_date.c" +#line 16942 "ext/date/lib/parse_date.c" yy1143: YYDEBUG(1143, *YYCURSOR); yych = *++YYCURSOR; @@ -19614,7 +19615,7 @@ yy1294: goto yy1298; yy1295: YYDEBUG(1295, *YYCURSOR); -#line 1065 "ext/date/lib/parse_date.re" +#line 1066 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("backof | frontof"); TIMELIB_INIT; @@ -19636,7 +19637,7 @@ yy1295: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19640 "ext/date/lib/parse_date.c" +#line 19641 "ext/date/lib/parse_date.c" yy1296: YYDEBUG(1296, *YYCURSOR); yyaccept = 28; @@ -21327,7 +21328,7 @@ yy1385: if (yych <= '9') goto yy1385; yy1387: YYDEBUG(1387, *YYCURSOR); -#line 1022 "ext/date/lib/parse_date.re" +#line 1023 "ext/date/lib/parse_date.re" { timelib_ull i; @@ -21352,7 +21353,7 @@ yy1387: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21356 "ext/date/lib/parse_date.c" +#line 21357 "ext/date/lib/parse_date.c" yy1388: YYDEBUG(1388, *YYCURSOR); yych = *++YYCURSOR; @@ -21788,7 +21789,7 @@ yy1416: ++YYCURSOR; yy1417: YYDEBUG(1417, *YYCURSOR); -#line 1010 "ext/date/lib/parse_date.re" +#line 1011 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("tomorrow"); TIMELIB_INIT; @@ -21799,7 +21800,7 @@ yy1417: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21803 "ext/date/lib/parse_date.c" +#line 21804 "ext/date/lib/parse_date.c" yy1418: YYDEBUG(1418, *YYCURSOR); yych = *++YYCURSOR; @@ -21834,7 +21835,7 @@ yy1419: } yy1420: YYDEBUG(1420, *YYCURSOR); -#line 1000 "ext/date/lib/parse_date.re" +#line 1001 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("midnight | today"); TIMELIB_INIT; @@ -21843,7 +21844,7 @@ yy1420: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21847 "ext/date/lib/parse_date.c" +#line 21848 "ext/date/lib/parse_date.c" yy1421: YYDEBUG(1421, *YYCURSOR); yych = *++YYCURSOR; @@ -23855,7 +23856,7 @@ yy1499: } yy1500: YYDEBUG(1500, *YYCURSOR); -#line 979 "ext/date/lib/parse_date.re" +#line 980 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("now"); TIMELIB_INIT; @@ -23863,7 +23864,7 @@ yy1500: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23867 "ext/date/lib/parse_date.c" +#line 23868 "ext/date/lib/parse_date.c" yy1501: YYDEBUG(1501, *YYCURSOR); yych = *++YYCURSOR; @@ -24002,7 +24003,7 @@ yy1507: } yy1508: YYDEBUG(1508, *YYCURSOR); -#line 988 "ext/date/lib/parse_date.re" +#line 989 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("noon"); TIMELIB_INIT; @@ -24013,7 +24014,7 @@ yy1508: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24017 "ext/date/lib/parse_date.c" +#line 24018 "ext/date/lib/parse_date.c" yy1509: YYDEBUG(1509, *YYCURSOR); yyaccept = 0; @@ -24546,7 +24547,7 @@ yy1530: ++YYCURSOR; yy1531: YYDEBUG(1531, *YYCURSOR); -#line 967 "ext/date/lib/parse_date.re" +#line 968 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("yesterday"); TIMELIB_INIT; @@ -24557,7 +24558,7 @@ yy1531: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24561 "ext/date/lib/parse_date.c" +#line 24562 "ext/date/lib/parse_date.c" yy1532: YYDEBUG(1532, *YYCURSOR); yyaccept = 0; @@ -24730,7 +24731,7 @@ yy1537: goto yy1531; } } -#line 1741 "ext/date/lib/parse_date.re" +#line 1742 "ext/date/lib/parse_date.re" } 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-- +<?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=== |