From b510868bb8dc475dbe628a7a2ba255f290c9864e Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 20 May 2022 12:53:37 +0100 Subject: [PATCH] Adjust existing tests for fixed bugs --- ext/date/lib/parse_date.c | 103 +++++++++++++++++------------------ ext/date/lib/parse_date.re | 1 - ext/date/tests/bug50392.phpt | 2 +- ext/date/tests/bug51866.phpt | 2 +- ext/date/tests/bug67253.phpt | 2 +- ext/date/tests/bug81097.phpt | 18 +++--- 6 files changed, 64 insertions(+), 64 deletions(-) diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 0059775203b..cd8829809e5 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.15.3 on Fri May 20 11:34:53 2022 */ +/* Generated by re2c 0.15.3 on Fri May 20 12:52:14 2022 */ #line 1 "ext/date/lib/parse_date.re" /* * The MIT License (MIT) @@ -1095,7 +1095,7 @@ yy2: } yy3: YYDEBUG(3, *YYCURSOR); -#line 1819 "ext/date/lib/parse_date.re" +#line 1818 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -1415,7 +1415,7 @@ yy11: if (yych <= '9') goto yy1483; yy12: YYDEBUG(12, *YYCURSOR); -#line 1914 "ext/date/lib/parse_date.re" +#line 1913 "ext/date/lib/parse_date.re" { add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character"); goto std; @@ -2664,7 +2664,7 @@ yy48: if (yych <= '9') goto yy54; yy49: YYDEBUG(49, *YYCURSOR); -#line 1903 "ext/date/lib/parse_date.re" +#line 1902 "ext/date/lib/parse_date.re" { goto std; } @@ -2677,7 +2677,7 @@ yy51: YYDEBUG(51, *YYCURSOR); ++YYCURSOR; YYDEBUG(52, *YYCURSOR); -#line 1908 "ext/date/lib/parse_date.re" +#line 1907 "ext/date/lib/parse_date.re" { s->pos = cursor; s->line++; goto std; @@ -3104,7 +3104,7 @@ yy83: if (yych == 's') goto yy85; yy84: YYDEBUG(84, *YYCURSOR); -#line 1887 "ext/date/lib/parse_date.re" +#line 1886 "ext/date/lib/parse_date.re" { timelib_ull i; DEBUG_OUTPUT("relative"); @@ -4128,7 +4128,7 @@ yy218: } yy219: YYDEBUG(219, *YYCURSOR); -#line 1750 "ext/date/lib/parse_date.re" +#line 1749 "ext/date/lib/parse_date.re" { const timelib_relunit* relunit; DEBUG_OUTPUT("daytext"); @@ -4691,7 +4691,7 @@ yy247: } yy248: YYDEBUG(248, *YYCURSOR); -#line 1809 "ext/date/lib/parse_date.re" +#line 1808 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("monthtext"); TIMELIB_INIT; @@ -4949,7 +4949,7 @@ yy261: goto yy267; yy262: YYDEBUG(262, *YYCURSOR); -#line 1555 "ext/date/lib/parse_date.re" +#line 1554 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datetextual | datenoyear"); @@ -5089,7 +5089,7 @@ yy275: } yy276: YYDEBUG(276, *YYCURSOR); -#line 1857 "ext/date/lib/parse_date.re" +#line 1856 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz"); @@ -5416,7 +5416,7 @@ yy300: YYDEBUG(300, *YYCURSOR); ++YYCURSOR; YYDEBUG(301, *YYCURSOR); -#line 1833 "ext/date/lib/parse_date.re" +#line 1832 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12"); TIMELIB_INIT; @@ -6117,7 +6117,7 @@ yy361: YYDEBUG(362, *YYCURSOR); ++YYCURSOR; YYDEBUG(363, *YYCURSOR); -#line 1527 "ext/date/lib/parse_date.re" +#line 1526 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenoday"); @@ -6361,7 +6361,7 @@ yy368: if (yych <= '9') goto yy372; yy371: YYDEBUG(371, *YYCURSOR); -#line 1671 "ext/date/lib/parse_date.re" +#line 1670 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextshort"); @@ -6956,7 +6956,7 @@ yy397: } yy398: YYDEBUG(398, *YYCURSOR); -#line 1729 "ext/date/lib/parse_date.re" +#line 1728 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("ago"); TIMELIB_INIT; @@ -8765,7 +8765,7 @@ yy460: ++YYCURSOR; yy461: YYDEBUG(461, *YYCURSOR); -#line 1420 "ext/date/lib/parse_date.re" +#line 1419 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash"); TIMELIB_INIT; @@ -8898,7 +8898,7 @@ yy484: YYDEBUG(484, *YYCURSOR); ++YYCURSOR; YYDEBUG(485, *YYCURSOR); -#line 1446 "ext/date/lib/parse_date.re" +#line 1445 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("iso8601datex"); TIMELIB_INIT; @@ -9663,7 +9663,7 @@ yy508: } yy509: YYDEBUG(509, *YYCURSOR); -#line 1569 "ext/date/lib/parse_date.re" +#line 1568 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenoyearrev"); TIMELIB_INIT; @@ -9815,7 +9815,7 @@ yy521: YYDEBUG(521, *YYCURSOR); ++YYCURSOR; YYDEBUG(522, *YYCURSOR); -#line 1273 "ext/date/lib/parse_date.re" +#line 1272 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12"); TIMELIB_INIT; @@ -9844,7 +9844,7 @@ yy523: } yy524: YYDEBUG(524, *YYCURSOR); -#line 1310 "ext/date/lib/parse_date.re" +#line 1309 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long"); @@ -10184,7 +10184,7 @@ yy556: YYDEBUG(556, *YYCURSOR); ++YYCURSOR; YYDEBUG(557, *YYCURSOR); -#line 1290 "ext/date/lib/parse_date.re" +#line 1289 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("mssqltime"); TIMELIB_INIT; @@ -10309,7 +10309,7 @@ yy567: if (yych <= '9') goto yy574; yy568: YYDEBUG(568, *YYCURSOR); -#line 1486 "ext/date/lib/parse_date.re" +#line 1485 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datefull"); @@ -11059,7 +11059,7 @@ yy638: YYDEBUG(639, *YYCURSOR); ++YYCURSOR; YYDEBUG(640, *YYCURSOR); -#line 1501 "ext/date/lib/parse_date.re" +#line 1500 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("pointed date YYYY"); TIMELIB_INIT; @@ -11106,7 +11106,7 @@ yy644: if (yych <= '9') goto yy638; yy645: YYDEBUG(645, *YYCURSOR); -#line 1513 "ext/date/lib/parse_date.re" +#line 1512 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pointed date YY"); @@ -11760,7 +11760,7 @@ yy689: } yy690: YYDEBUG(690, *YYCURSOR); -#line 1472 "ext/date/lib/parse_date.re" +#line 1471 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshort"); @@ -11879,7 +11879,7 @@ yy699: } yy700: YYDEBUG(700, *YYCURSOR); -#line 1404 "ext/date/lib/parse_date.re" +#line 1403 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("americanshort | american"); @@ -12128,7 +12128,7 @@ yy733: if (yych <= ':') goto yy737; yy734: YYDEBUG(734, *YYCURSOR); -#line 1699 "ext/date/lib/parse_date.re" +#line 1698 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("clf"); @@ -12768,7 +12768,7 @@ yy807: } yy808: YYDEBUG(808, *YYCURSOR); -#line 1432 "ext/date/lib/parse_date.re" +#line 1431 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("iso8601date2"); @@ -12820,7 +12820,7 @@ yy815: YYDEBUG(815, *YYCURSOR); ++YYCURSOR; YYDEBUG(816, *YYCURSOR); -#line 1685 "ext/date/lib/parse_date.re" +#line 1684 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextreverse"); @@ -12998,7 +12998,7 @@ yy827: } yy828: YYDEBUG(828, *YYCURSOR); -#line 1720 "ext/date/lib/parse_date.re" +#line 1719 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("year4"); TIMELIB_INIT; @@ -13211,7 +13211,7 @@ yy837: } yy838: YYDEBUG(838, *YYCURSOR); -#line 1541 "ext/date/lib/parse_date.re" +#line 1540 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenodayrev"); @@ -13445,7 +13445,7 @@ yy858: if (yych <= '7') goto yy861; yy859: YYDEBUG(859, *YYCURSOR); -#line 1652 "ext/date/lib/parse_date.re" +#line 1651 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweek"); @@ -13473,7 +13473,7 @@ yy861: YYDEBUG(861, *YYCURSOR); ++YYCURSOR; YYDEBUG(862, *YYCURSOR); -#line 1633 "ext/date/lib/parse_date.re" +#line 1632 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweekday"); @@ -13563,7 +13563,7 @@ yy865: } yy866: YYDEBUG(866, *YYCURSOR); -#line 1619 "ext/date/lib/parse_date.re" +#line 1618 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgydotd"); @@ -13679,7 +13679,7 @@ yy886: ++YYCURSOR; yy887: YYDEBUG(887, *YYCURSOR); -#line 1593 "ext/date/lib/parse_date.re" +#line 1592 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif"); @@ -14000,7 +14000,7 @@ yy892: } yy893: YYDEBUG(893, *YYCURSOR); -#line 1581 "ext/date/lib/parse_date.re" +#line 1580 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenocolon"); TIMELIB_INIT; @@ -14933,7 +14933,7 @@ yy1017: } yy1018: YYDEBUG(1018, *YYCURSOR); -#line 1458 "ext/date/lib/parse_date.re" +#line 1457 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshorter"); @@ -16154,7 +16154,7 @@ yy1125: } yy1127: YYDEBUG(1127, *YYCURSOR); -#line 1338 "ext/date/lib/parse_date.re" +#line 1337 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("gnunocolon"); TIMELIB_INIT; @@ -16276,7 +16276,7 @@ yy1134: } yy1135: YYDEBUG(1135, *YYCURSOR); -#line 1384 "ext/date/lib/parse_date.re" +#line 1383 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("iso8601nocolon"); @@ -17271,7 +17271,7 @@ yy1178: } yy1179: YYDEBUG(1179, *YYCURSOR); -#line 1792 "ext/date/lib/parse_date.re" +#line 1791 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -17353,7 +17353,7 @@ yy1188: YYDEBUG(1188, *YYCURSOR); ++YYCURSOR; YYDEBUG(1189, *YYCURSOR); -#line 1251 "ext/date/lib/parse_date.re" +#line 1250 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -17514,7 +17514,7 @@ yy1205: } yy1206: YYDEBUG(1206, *YYCURSOR); -#line 1768 "ext/date/lib/parse_date.re" +#line 1767 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -20486,7 +20486,7 @@ yy1387: } yy1388: YYDEBUG(1388, *YYCURSOR); -#line 1228 "ext/date/lib/parse_date.re" +#line 1227 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("backof | frontof"); TIMELIB_INIT; @@ -20812,7 +20812,6 @@ yy1410: DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; TIMELIB_HAVE_RELATIVE(); - TIMELIB_UNHAVE_TIME(); /* skip "last day of" or "first day of" */ if (*ptr == 'l' || *ptr == 'L') { @@ -20824,7 +20823,7 @@ yy1410: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 20828 "" +#line 20827 "" yy1412: YYDEBUG(1412, *YYCURSOR); yyaccept = 1; @@ -22371,7 +22370,7 @@ yy1485: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22375 "" +#line 22374 "" yy1486: YYDEBUG(1486, *YYCURSOR); ++YYCURSOR; @@ -22418,7 +22417,7 @@ yy1487: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22422 "" +#line 22421 "" yy1488: YYDEBUG(1488, *YYCURSOR); yych = *++YYCURSOR; @@ -22898,7 +22897,7 @@ yy1524: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22902 "" +#line 22901 "" yy1525: YYDEBUG(1525, *YYCURSOR); yych = *++YYCURSOR; @@ -22942,7 +22941,7 @@ yy1527: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 22946 "" +#line 22945 "" yy1528: YYDEBUG(1528, *YYCURSOR); yych = *++YYCURSOR; @@ -25045,7 +25044,7 @@ yy1612: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 25049 "" +#line 25048 "" yy1613: YYDEBUG(1613, *YYCURSOR); yych = *++YYCURSOR; @@ -25195,7 +25194,7 @@ yy1620: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 25199 "" +#line 25198 "" yy1621: YYDEBUG(1621, *YYCURSOR); yyaccept = 1; @@ -25739,7 +25738,7 @@ yy1643: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 25743 "" +#line 25742 "" yy1644: YYDEBUG(1644, *YYCURSOR); yyaccept = 1; @@ -25912,7 +25911,7 @@ yy1649: goto yy1643; } } -#line 1918 "ext/date/lib/parse_date.re" +#line 1917 "ext/date/lib/parse_date.re" } diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index b8252ab69e9..6240e47d519 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -1211,7 +1211,6 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr) DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; TIMELIB_HAVE_RELATIVE(); - TIMELIB_UNHAVE_TIME(); /* skip "last day of" or "first day of" */ if (*ptr == 'l' || *ptr == 'L') { diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt index 64def49f66f..a347f02c798 100644 --- a/ext/date/tests/bug50392.phpt +++ b/ext/date/tests/bug50392.phpt @@ -20,7 +20,7 @@ for ($i = 0; $i < 8; $i++) { --EXPECT-- 2009-03-01 18:00:00. - X -- Data missing +- Not enough data available to satisfy format 2009-03-01 18:00:00.1 - 0.1 diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt index 1751add68d5..921a9392932 100644 --- a/ext/date/tests/bug51866.phpt +++ b/ext/date/tests/bug51866.phpt @@ -133,7 +133,7 @@ array(4) { ["errors"]=> array(1) { [10]=> - string(12) "Data missing" + string(%d) "Not enough data available to satisfy format" } } diff --git a/ext/date/tests/bug67253.phpt b/ext/date/tests/bug67253.phpt index 53c587c2901..4e213ca87d9 100644 --- a/ext/date/tests/bug67253.phpt +++ b/ext/date/tests/bug67253.phpt @@ -35,7 +35,7 @@ array(12) { [0]=> string(29) "A meridian could not be found" [9]=> - string(12) "Data missing" + string(43) "Not enough data available to satisfy format" } ["is_localtime"]=> bool(false) diff --git a/ext/date/tests/bug81097.phpt b/ext/date/tests/bug81097.phpt index 2bfec485955..2cfd7e00a9d 100644 --- a/ext/date/tests/bug81097.phpt +++ b/ext/date/tests/bug81097.phpt @@ -1,12 +1,14 @@ --TEST-- -Bug #81097: DateTimeZone silently falls back to UTC when providing an offset with seconds +Bug #81097 (DateTimeZone silently falls back to UTC when providing an offset with seconds) --FILE-- getMessage(); -} +$d = new DatetimeZone('+01:45:30'); +var_dump($d); ?> ---EXPECT-- -DateTimeZone::__construct(): Unknown or bad timezone (+01:45:30) +--EXPECTF-- +object(DateTimeZone)#%d (%d) { + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+01:45" +}