1
0
mirror of https://github.com/php/php-src.git synced 2026-04-02 05:32:28 +02:00

Merge remote-tracking branch 'derickr/timelib-2021-17-integration' into PHP-8.1

This commit is contained in:
Derick Rethans
2022-09-14 16:25:43 +01:00
9 changed files with 175 additions and 138 deletions

View File

@@ -1,4 +1,4 @@
/* Generated by re2c 0.15.3 on Sun Jun 26 17:34:01 2022 */
/* Generated by re2c 0.15.3 on Wed Sep 14 10:36:03 2022 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@@ -362,7 +362,7 @@ static timelib_error_message *alloc_error_message(timelib_error_message **messag
return *messages + (*count)++;
}
static void add_warning(Scanner *s, int error_code, char *error)
static void add_warning(Scanner *s, int error_code, const char *error)
{
timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
@@ -372,7 +372,7 @@ static void add_warning(Scanner *s, int error_code, char *error)
message->message = timelib_strdup(error);
}
static void add_error(Scanner *s, int error_code, char *error)
static void add_error(Scanner *s, int error_code, const char *error)
{
timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
@@ -382,7 +382,7 @@ static void add_error(Scanner *s, int error_code, char *error)
message->message = timelib_strdup(error);
}
static void add_pbf_warning(Scanner *s, int error_code, char *error, const char *sptr, const char *cptr)
static void add_pbf_warning(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
@@ -392,7 +392,7 @@ static void add_pbf_warning(Scanner *s, int error_code, char *error, const char
message->message = timelib_strdup(error);
}
static void add_pbf_error(Scanner *s, int error_code, char *error, const char *sptr, const char *cptr)
static void add_pbf_error(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
@@ -522,7 +522,6 @@ static timelib_sll timelib_get_frac_nr(const char **ptr)
const char *begin, *end;
char *str;
double tmp_nr = TIMELIB_UNSET;
int len = 0;
while ((**ptr != '.') && (**ptr != ':') && ((**ptr < '0') || (**ptr > '9'))) {
if (**ptr == '\0') {
@@ -533,7 +532,6 @@ static timelib_sll timelib_get_frac_nr(const char **ptr)
begin = *ptr;
while ((**ptr == '.') || (**ptr == ':') || ((**ptr >= '0') && (**ptr <= '9'))) {
++*ptr;
++len;
}
end = *ptr;
str = timelib_calloc(1, end - begin);
@@ -954,11 +952,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 1085 "ext/date/lib/parse_date.re"
#line 1083 "ext/date/lib/parse_date.re"
#line 962 "<stdout>"
#line 960 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1096,7 +1094,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1819 "ext/date/lib/parse_date.re"
#line 1817 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1109,7 +1107,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1113 "<stdout>"
#line 1111 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1416,12 +1414,12 @@ yy11:
if (yych <= '9') goto yy1483;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1914 "ext/date/lib/parse_date.re"
#line 1912 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
#line 1425 "<stdout>"
#line 1423 "<stdout>"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2665,11 +2663,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1903 "ext/date/lib/parse_date.re"
#line 1901 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2673 "<stdout>"
#line 2671 "<stdout>"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2678,12 +2676,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1908 "ext/date/lib/parse_date.re"
#line 1906 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2687 "<stdout>"
#line 2685 "<stdout>"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3105,7 +3103,7 @@ yy83:
if (yych == 's') goto yy85;
yy84:
YYDEBUG(84, *YYCURSOR);
#line 1887 "ext/date/lib/parse_date.re"
#line 1885 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -3120,7 +3118,7 @@ yy84:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 3124 "<stdout>"
#line 3122 "<stdout>"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4129,7 +4127,7 @@ yy218:
}
yy219:
YYDEBUG(219, *YYCURSOR);
#line 1750 "ext/date/lib/parse_date.re"
#line 1748 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -4146,7 +4144,7 @@ yy219:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 4150 "<stdout>"
#line 4148 "<stdout>"
yy220:
YYDEBUG(220, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4692,7 +4690,7 @@ yy247:
}
yy248:
YYDEBUG(248, *YYCURSOR);
#line 1809 "ext/date/lib/parse_date.re"
#line 1807 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4701,7 +4699,7 @@ yy248:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4705 "<stdout>"
#line 4703 "<stdout>"
yy249:
YYDEBUG(249, *YYCURSOR);
++YYCURSOR;
@@ -4950,7 +4948,7 @@ yy261:
goto yy267;
yy262:
YYDEBUG(262, *YYCURSOR);
#line 1555 "ext/date/lib/parse_date.re"
#line 1553 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4963,7 +4961,7 @@ yy262:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4967 "<stdout>"
#line 4965 "<stdout>"
yy263:
YYDEBUG(263, *YYCURSOR);
yyaccept = 6;
@@ -5090,7 +5088,7 @@ yy275:
}
yy276:
YYDEBUG(276, *YYCURSOR);
#line 1857 "ext/date/lib/parse_date.re"
#line 1855 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -5119,7 +5117,7 @@ yy276:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5123 "<stdout>"
#line 5121 "<stdout>"
yy277:
YYDEBUG(277, *YYCURSOR);
yyaccept = 7;
@@ -5417,7 +5415,7 @@ yy300:
YYDEBUG(300, *YYCURSOR);
++YYCURSOR;
YYDEBUG(301, *YYCURSOR);
#line 1833 "ext/date/lib/parse_date.re"
#line 1831 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5440,7 +5438,7 @@ yy300:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5444 "<stdout>"
#line 5442 "<stdout>"
yy302:
YYDEBUG(302, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6118,7 +6116,7 @@ yy361:
YYDEBUG(362, *YYCURSOR);
++YYCURSOR;
YYDEBUG(363, *YYCURSOR);
#line 1527 "ext/date/lib/parse_date.re"
#line 1525 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -6131,7 +6129,7 @@ yy361:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 6135 "<stdout>"
#line 6133 "<stdout>"
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6362,7 +6360,7 @@ yy368:
if (yych <= '9') goto yy372;
yy371:
YYDEBUG(371, *YYCURSOR);
#line 1671 "ext/date/lib/parse_date.re"
#line 1669 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6375,7 +6373,7 @@ yy371:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6379 "<stdout>"
#line 6377 "<stdout>"
yy372:
YYDEBUG(372, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6957,7 +6955,7 @@ yy397:
}
yy398:
YYDEBUG(398, *YYCURSOR);
#line 1729 "ext/date/lib/parse_date.re"
#line 1727 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -6977,7 +6975,7 @@ yy398:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 6981 "<stdout>"
#line 6979 "<stdout>"
yy399:
YYDEBUG(399, *YYCURSOR);
yyaccept = 5;
@@ -8766,7 +8764,7 @@ yy460:
++YYCURSOR;
yy461:
YYDEBUG(461, *YYCURSOR);
#line 1420 "ext/date/lib/parse_date.re"
#line 1418 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -8777,7 +8775,7 @@ yy461:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8781 "<stdout>"
#line 8779 "<stdout>"
yy462:
YYDEBUG(462, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8899,7 +8897,7 @@ yy484:
YYDEBUG(484, *YYCURSOR);
++YYCURSOR;
YYDEBUG(485, *YYCURSOR);
#line 1446 "ext/date/lib/parse_date.re"
#line 1444 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@@ -8910,7 +8908,7 @@ yy484:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8914 "<stdout>"
#line 8912 "<stdout>"
yy486:
YYDEBUG(486, *YYCURSOR);
yyaccept = 1;
@@ -9664,7 +9662,7 @@ yy508:
}
yy509:
YYDEBUG(509, *YYCURSOR);
#line 1569 "ext/date/lib/parse_date.re"
#line 1567 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9675,7 +9673,7 @@ yy509:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9679 "<stdout>"
#line 9677 "<stdout>"
yy510:
YYDEBUG(510, *YYCURSOR);
yyaccept = 9;
@@ -9816,7 +9814,7 @@ yy521:
YYDEBUG(521, *YYCURSOR);
++YYCURSOR;
YYDEBUG(522, *YYCURSOR);
#line 1273 "ext/date/lib/parse_date.re"
#line 1271 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9832,7 +9830,7 @@ yy521:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9836 "<stdout>"
#line 9834 "<stdout>"
yy523:
YYDEBUG(523, *YYCURSOR);
yyaccept = 10;
@@ -9845,7 +9843,7 @@ yy523:
}
yy524:
YYDEBUG(524, *YYCURSOR);
#line 1310 "ext/date/lib/parse_date.re"
#line 1308 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@@ -9872,7 +9870,7 @@ yy524:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9876 "<stdout>"
#line 9874 "<stdout>"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 10;
@@ -10185,7 +10183,7 @@ yy556:
YYDEBUG(556, *YYCURSOR);
++YYCURSOR;
YYDEBUG(557, *YYCURSOR);
#line 1290 "ext/date/lib/parse_date.re"
#line 1288 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10204,7 +10202,7 @@ yy556:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10208 "<stdout>"
#line 10206 "<stdout>"
yy558:
YYDEBUG(558, *YYCURSOR);
yyaccept = 10;
@@ -10310,7 +10308,7 @@ yy567:
if (yych <= '9') goto yy574;
yy568:
YYDEBUG(568, *YYCURSOR);
#line 1486 "ext/date/lib/parse_date.re"
#line 1484 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10324,7 +10322,7 @@ yy568:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10328 "<stdout>"
#line 10326 "<stdout>"
yy569:
YYDEBUG(569, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11060,7 +11058,7 @@ yy638:
YYDEBUG(639, *YYCURSOR);
++YYCURSOR;
YYDEBUG(640, *YYCURSOR);
#line 1501 "ext/date/lib/parse_date.re"
#line 1499 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11071,7 +11069,7 @@ yy638:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11075 "<stdout>"
#line 11073 "<stdout>"
yy641:
YYDEBUG(641, *YYCURSOR);
yyaccept = 10;
@@ -11107,7 +11105,7 @@ yy644:
if (yych <= '9') goto yy638;
yy645:
YYDEBUG(645, *YYCURSOR);
#line 1513 "ext/date/lib/parse_date.re"
#line 1511 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11120,7 +11118,7 @@ yy645:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11124 "<stdout>"
#line 11122 "<stdout>"
yy646:
YYDEBUG(646, *YYCURSOR);
yyaccept = 10;
@@ -11761,7 +11759,7 @@ yy689:
}
yy690:
YYDEBUG(690, *YYCURSOR);
#line 1472 "ext/date/lib/parse_date.re"
#line 1470 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11774,7 +11772,7 @@ yy690:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11778 "<stdout>"
#line 11776 "<stdout>"
yy691:
YYDEBUG(691, *YYCURSOR);
yyaccept = 12;
@@ -11880,7 +11878,7 @@ yy699:
}
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1404 "ext/date/lib/parse_date.re"
#line 1402 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11895,7 +11893,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11899 "<stdout>"
#line 11897 "<stdout>"
yy701:
YYDEBUG(701, *YYCURSOR);
yyaccept = 13;
@@ -12129,7 +12127,7 @@ yy733:
if (yych <= ':') goto yy737;
yy734:
YYDEBUG(734, *YYCURSOR);
#line 1699 "ext/date/lib/parse_date.re"
#line 1697 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12149,7 +12147,7 @@ yy734:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12153 "<stdout>"
#line 12151 "<stdout>"
yy735:
YYDEBUG(735, *YYCURSOR);
yyaccept = 14;
@@ -12769,7 +12767,7 @@ yy807:
}
yy808:
YYDEBUG(808, *YYCURSOR);
#line 1432 "ext/date/lib/parse_date.re"
#line 1430 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12782,7 +12780,7 @@ yy808:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12786 "<stdout>"
#line 12784 "<stdout>"
yy809:
YYDEBUG(809, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12821,7 +12819,7 @@ yy815:
YYDEBUG(815, *YYCURSOR);
++YYCURSOR;
YYDEBUG(816, *YYCURSOR);
#line 1685 "ext/date/lib/parse_date.re"
#line 1683 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12834,7 +12832,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12838 "<stdout>"
#line 12836 "<stdout>"
yy817:
YYDEBUG(817, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12999,7 +12997,7 @@ yy827:
}
yy828:
YYDEBUG(828, *YYCURSOR);
#line 1720 "ext/date/lib/parse_date.re"
#line 1718 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -13007,7 +13005,7 @@ yy828:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 13011 "<stdout>"
#line 13009 "<stdout>"
yy829:
YYDEBUG(829, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13212,7 +13210,7 @@ yy837:
}
yy838:
YYDEBUG(838, *YYCURSOR);
#line 1541 "ext/date/lib/parse_date.re"
#line 1539 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13225,7 +13223,7 @@ yy838:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 13229 "<stdout>"
#line 13227 "<stdout>"
yy839:
YYDEBUG(839, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13446,7 +13444,7 @@ yy858:
if (yych <= '7') goto yy861;
yy859:
YYDEBUG(859, *YYCURSOR);
#line 1652 "ext/date/lib/parse_date.re"
#line 1650 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13464,7 +13462,7 @@ yy859:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13468 "<stdout>"
#line 13466 "<stdout>"
yy860:
YYDEBUG(860, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13474,7 +13472,7 @@ yy861:
YYDEBUG(861, *YYCURSOR);
++YYCURSOR;
YYDEBUG(862, *YYCURSOR);
#line 1633 "ext/date/lib/parse_date.re"
#line 1631 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13492,7 +13490,7 @@ yy861:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13496 "<stdout>"
#line 13494 "<stdout>"
yy863:
YYDEBUG(863, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13564,7 +13562,7 @@ yy865:
}
yy866:
YYDEBUG(866, *YYCURSOR);
#line 1619 "ext/date/lib/parse_date.re"
#line 1617 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13577,7 +13575,7 @@ yy866:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13581 "<stdout>"
#line 13579 "<stdout>"
yy867:
YYDEBUG(867, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13680,7 +13678,7 @@ yy886:
++YYCURSOR;
yy887:
YYDEBUG(887, *YYCURSOR);
#line 1593 "ext/date/lib/parse_date.re"
#line 1591 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13705,7 +13703,7 @@ yy887:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13709 "<stdout>"
#line 13707 "<stdout>"
yy888:
YYDEBUG(888, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14001,7 +13999,7 @@ yy892:
}
yy893:
YYDEBUG(893, *YYCURSOR);
#line 1581 "ext/date/lib/parse_date.re"
#line 1579 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -14012,7 +14010,7 @@ yy893:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 14016 "<stdout>"
#line 14014 "<stdout>"
yy894:
YYDEBUG(894, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14934,7 +14932,7 @@ yy1017:
}
yy1018:
YYDEBUG(1018, *YYCURSOR);
#line 1458 "ext/date/lib/parse_date.re"
#line 1456 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14947,7 +14945,7 @@ yy1018:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14951 "<stdout>"
#line 14949 "<stdout>"
yy1019:
YYDEBUG(1019, *YYCURSOR);
yyaccept = 22;
@@ -16155,7 +16153,7 @@ yy1125:
}
yy1127:
YYDEBUG(1127, *YYCURSOR);
#line 1338 "ext/date/lib/parse_date.re"
#line 1336 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -16177,7 +16175,7 @@ yy1127:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 16181 "<stdout>"
#line 16179 "<stdout>"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16277,7 +16275,7 @@ yy1134:
}
yy1135:
YYDEBUG(1135, *YYCURSOR);
#line 1384 "ext/date/lib/parse_date.re"
#line 1382 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -16296,7 +16294,7 @@ yy1135:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 16300 "<stdout>"
#line 16298 "<stdout>"
yy1136:
YYDEBUG(1136, *YYCURSOR);
yyaccept = 25;
@@ -17272,7 +17270,7 @@ yy1178:
}
yy1179:
YYDEBUG(1179, *YYCURSOR);
#line 1792 "ext/date/lib/parse_date.re"
#line 1790 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17288,7 +17286,7 @@ yy1179:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17292 "<stdout>"
#line 17290 "<stdout>"
yy1180:
YYDEBUG(1180, *YYCURSOR);
++YYCURSOR;
@@ -17354,7 +17352,7 @@ yy1188:
YYDEBUG(1188, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1189, *YYCURSOR);
#line 1251 "ext/date/lib/parse_date.re"
#line 1249 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17375,7 +17373,7 @@ yy1188:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 17379 "<stdout>"
#line 17377 "<stdout>"
yy1190:
YYDEBUG(1190, *YYCURSOR);
yyaccept = 26;
@@ -17515,7 +17513,7 @@ yy1205:
}
yy1206:
YYDEBUG(1206, *YYCURSOR);
#line 1768 "ext/date/lib/parse_date.re"
#line 1766 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17538,7 +17536,7 @@ yy1206:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17542 "<stdout>"
#line 17540 "<stdout>"
yy1207:
YYDEBUG(1207, *YYCURSOR);
yych = *++YYCURSOR;
@@ -20487,7 +20485,7 @@ yy1387:
}
yy1388:
YYDEBUG(1388, *YYCURSOR);
#line 1228 "ext/date/lib/parse_date.re"
#line 1226 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -20509,7 +20507,7 @@ yy1388:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20513 "<stdout>"
#line 20511 "<stdout>"
yy1389:
YYDEBUG(1389, *YYCURSOR);
yyaccept = 28;
@@ -20808,7 +20806,7 @@ yy1410:
YYDEBUG(1410, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1411, *YYCURSOR);
#line 1211 "ext/date/lib/parse_date.re"
#line 1209 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -20824,7 +20822,7 @@ yy1410:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20828 "<stdout>"
#line 20826 "<stdout>"
yy1412:
YYDEBUG(1412, *YYCURSOR);
yyaccept = 1;
@@ -22346,7 +22344,7 @@ yy1483:
if (yych <= '9') goto yy1483;
yy1485:
YYDEBUG(1485, *YYCURSOR);
#line 1145 "ext/date/lib/parse_date.re"
#line 1143 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -22371,7 +22369,7 @@ yy1485:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22375 "<stdout>"
#line 22373 "<stdout>"
yy1486:
YYDEBUG(1486, *YYCURSOR);
++YYCURSOR;
@@ -22379,7 +22377,7 @@ yy1486:
if (yych <= '9') goto yy1488;
yy1487:
YYDEBUG(1487, *YYCURSOR);
#line 1171 "ext/date/lib/parse_date.re"
#line 1169 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@@ -22418,7 +22416,7 @@ yy1487:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22422 "<stdout>"
#line 22420 "<stdout>"
yy1488:
YYDEBUG(1488, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22887,7 +22885,7 @@ yy1523:
++YYCURSOR;
yy1524:
YYDEBUG(1524, *YYCURSOR);
#line 1133 "ext/date/lib/parse_date.re"
#line 1131 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -22898,7 +22896,7 @@ yy1524:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22902 "<stdout>"
#line 22900 "<stdout>"
yy1525:
YYDEBUG(1525, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22933,7 +22931,7 @@ yy1526:
}
yy1527:
YYDEBUG(1527, *YYCURSOR);
#line 1123 "ext/date/lib/parse_date.re"
#line 1121 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -22942,7 +22940,7 @@ yy1527:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22946 "<stdout>"
#line 22944 "<stdout>"
yy1528:
YYDEBUG(1528, *YYCURSOR);
yych = *++YYCURSOR;
@@ -25037,7 +25035,7 @@ yy1611:
}
yy1612:
YYDEBUG(1612, *YYCURSOR);
#line 1102 "ext/date/lib/parse_date.re"
#line 1100 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -25045,7 +25043,7 @@ yy1612:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25049 "<stdout>"
#line 25047 "<stdout>"
yy1613:
YYDEBUG(1613, *YYCURSOR);
yych = *++YYCURSOR;
@@ -25184,7 +25182,7 @@ yy1619:
}
yy1620:
YYDEBUG(1620, *YYCURSOR);
#line 1111 "ext/date/lib/parse_date.re"
#line 1109 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -25195,7 +25193,7 @@ yy1620:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25199 "<stdout>"
#line 25197 "<stdout>"
yy1621:
YYDEBUG(1621, *YYCURSOR);
yyaccept = 1;
@@ -25728,7 +25726,7 @@ yy1642:
++YYCURSOR;
yy1643:
YYDEBUG(1643, *YYCURSOR);
#line 1090 "ext/date/lib/parse_date.re"
#line 1088 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -25739,7 +25737,7 @@ yy1643:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25743 "<stdout>"
#line 25741 "<stdout>"
yy1644:
YYDEBUG(1644, *YYCURSOR);
yyaccept = 1;
@@ -25912,7 +25910,7 @@ yy1649:
goto yy1643;
}
}
#line 1918 "ext/date/lib/parse_date.re"
#line 1916 "ext/date/lib/parse_date.re"
}
@@ -26609,15 +26607,18 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
if (parsed->h == TIMELIB_UNSET) parsed->h = now->h != TIMELIB_UNSET ? now->h : 0;
if (parsed->i == TIMELIB_UNSET) parsed->i = now->i != TIMELIB_UNSET ? now->i : 0;
if (parsed->s == TIMELIB_UNSET) parsed->s = now->s != TIMELIB_UNSET ? now->s : 0;
if (parsed->z == TIMELIB_UNSET) parsed->z = now->z != TIMELIB_UNSET ? now->z : 0;
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
if (!parsed->tz_abbr) {
parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
}
if (!parsed->tz_info) {
parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
if (parsed->z == TIMELIB_UNSET) parsed->z = now->z != TIMELIB_UNSET ? now->z : 0;
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
if (!parsed->tz_abbr) {
parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
}
}
if (parsed->zone_type == 0 && now->zone_type != 0) {
parsed->zone_type = now->zone_type;
/* parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
@@ -26629,7 +26630,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
const char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;

View File

@@ -360,7 +360,7 @@ static timelib_error_message *alloc_error_message(timelib_error_message **messag
return *messages + (*count)++;
}
static void add_warning(Scanner *s, int error_code, char *error)
static void add_warning(Scanner *s, int error_code, const char *error)
{
timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
@@ -370,7 +370,7 @@ static void add_warning(Scanner *s, int error_code, char *error)
message->message = timelib_strdup(error);
}
static void add_error(Scanner *s, int error_code, char *error)
static void add_error(Scanner *s, int error_code, const char *error)
{
timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
@@ -380,7 +380,7 @@ static void add_error(Scanner *s, int error_code, char *error)
message->message = timelib_strdup(error);
}
static void add_pbf_warning(Scanner *s, int error_code, char *error, const char *sptr, const char *cptr)
static void add_pbf_warning(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
timelib_error_message *message = alloc_error_message(&s->errors->warning_messages, &s->errors->warning_count);
@@ -390,7 +390,7 @@ static void add_pbf_warning(Scanner *s, int error_code, char *error, const char
message->message = timelib_strdup(error);
}
static void add_pbf_error(Scanner *s, int error_code, char *error, const char *sptr, const char *cptr)
static void add_pbf_error(Scanner *s, int error_code, const char *error, const char *sptr, const char *cptr)
{
timelib_error_message *message = alloc_error_message(&s->errors->error_messages, &s->errors->error_count);
@@ -520,7 +520,6 @@ static timelib_sll timelib_get_frac_nr(const char **ptr)
const char *begin, *end;
char *str;
double tmp_nr = TIMELIB_UNSET;
int len = 0;
while ((**ptr != '.') && (**ptr != ':') && ((**ptr < '0') || (**ptr > '9'))) {
if (**ptr == '\0') {
@@ -531,7 +530,6 @@ static timelib_sll timelib_get_frac_nr(const char **ptr)
begin = *ptr;
while ((**ptr == '.') || (**ptr == ':') || ((**ptr >= '0') && (**ptr <= '9'))) {
++*ptr;
++len;
}
end = *ptr;
str = timelib_calloc(1, end - begin);
@@ -2611,15 +2609,18 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
if (parsed->h == TIMELIB_UNSET) parsed->h = now->h != TIMELIB_UNSET ? now->h : 0;
if (parsed->i == TIMELIB_UNSET) parsed->i = now->i != TIMELIB_UNSET ? now->i : 0;
if (parsed->s == TIMELIB_UNSET) parsed->s = now->s != TIMELIB_UNSET ? now->s : 0;
if (parsed->z == TIMELIB_UNSET) parsed->z = now->z != TIMELIB_UNSET ? now->z : 0;
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
if (!parsed->tz_abbr) {
parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
}
if (!parsed->tz_info) {
parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
if (parsed->z == TIMELIB_UNSET) parsed->z = now->z != TIMELIB_UNSET ? now->z : 0;
if (parsed->dst == TIMELIB_UNSET) parsed->dst = now->dst != TIMELIB_UNSET ? now->dst : 0;
if (!parsed->tz_abbr) {
parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
}
}
if (parsed->zone_type == 0 && now->zone_type != 0) {
parsed->zone_type = now->zone_type;
/* parsed->tz_abbr = now->tz_abbr ? timelib_strdup(now->tz_abbr) : NULL;
@@ -2631,7 +2632,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
*/
}
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
const char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst)
{
const timelib_tz_lookup_table *tp;

View File

@@ -1,4 +1,4 @@
/* Generated by re2c 0.15.3 on Sun Jun 26 17:34:21 2022 */
/* Generated by re2c 0.15.3 on Wed Sep 14 10:36:13 2022 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
* The MIT License (MIT)
@@ -88,7 +88,7 @@ typedef struct _Scanner {
int have_end_date;
} Scanner;
static void add_error(Scanner *s, char *error)
static void add_error(Scanner *s, const char *error)
{
s->errors->error_count++;
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));

View File

@@ -86,7 +86,7 @@ typedef struct _Scanner {
int have_end_date;
} Scanner;
static void add_error(Scanner *s, char *error)
static void add_error(Scanner *s, const char *error)
{
s->errors->error_count++;
s->errors->error_messages = timelib_realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));

View File

@@ -30,9 +30,9 @@
# include "timelib_config.h"
#endif
#define TIMELIB_VERSION 202116
#define TIMELIB_EXTENDED_VERSION 20211601
#define TIMELIB_ASCII_VERSION "2021.16"
#define TIMELIB_VERSION 202117
#define TIMELIB_EXTENDED_VERSION 20211701
#define TIMELIB_ASCII_VERSION "2021.17"
#include <stdlib.h>
#include <stdbool.h>
@@ -342,10 +342,10 @@ typedef struct _timelib_error_container {
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
char *name;
const char *name;
int type;
float gmtoffset;
char *full_tz_name;
const char *full_tz_name;
} timelib_tz_lookup_table;
typedef struct _timelib_tzdb_index_entry {
@@ -354,7 +354,7 @@ typedef struct _timelib_tzdb_index_entry {
} timelib_tzdb_index_entry;
typedef struct _timelib_tzdb {
char *version;
const char *version;
int index_size;
const timelib_tzdb_index_entry *index;
const unsigned char *data;
@@ -583,7 +583,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
*
* The returned char* is not duplicated, and should not be freed.
*/
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
const char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
/* Returns an array of known time zone abbreviations
*

View File

@@ -112,6 +112,20 @@
m = NULL; \
}
#if defined (__GNUC__)
# define TIMELIB_GNUC_CHECK_VERSION(major, minor) \
((__GNUC__ > (major)) || \
((__GNUC__ == (major)) && (__GNUC_MINOR__ >= (minor))))
#else
# define TIMELIB_GNUC_CHECK_VERSION(major, minor) 0
#endif
#if TIMELIB_GNUC_CHECK_VERSION(7, 0)
# define TIMELIB_BREAK_INTENTIONALLY_MISSING __attribute__ ((fallthrough));
#else
# define TIMELIB_BREAK_INTENTIONALLY_MISSING
#endif
struct _ttinfo
{
int32_t offset;

View File

@@ -372,7 +372,7 @@ static void do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
case TIMELIB_ZONETYPE_ID:
tzi = tz->tz_info;
/* Break intentionally missing */
TIMELIB_BREAK_INTENTIONALLY_MISSING
default: {
/* No timezone in struct, fallback to reference if possible */

View File

@@ -3585,7 +3585,7 @@ PHP_FUNCTION(timezone_name_get)
PHP_FUNCTION(timezone_name_from_abbr)
{
zend_string *abbr;
char *tzid;
const char *tzid;
zend_long gmtoffset = -1;
zend_long isdst = -1;

View File

@@ -0,0 +1,21 @@
--TEST--
GH-9165 (strtotime translates a date-time with DST/non-DST hour differently based on default timezone)
--FILE--
<?php
date_default_timezone_set('America/Lower_Princes');
echo strtotime("2018-10-28 01:00:00 Europe/London") . PHP_EOL;
date_default_timezone_set('Europe/London');
echo strtotime("2018-10-28 01:00:00 Europe/London"). PHP_EOL;
date_default_timezone_set('America/Lower_Princes');
echo strtotime("2018-10-28 04:00:00 Europe/London") . PHP_EOL;
date_default_timezone_set('Europe/London');
echo strtotime("2018-10-28 04:00:00 Europe/London"). PHP_EOL;
?>
--EXPECT--
1540684800
1540684800
1540699200
1540699200