1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 22:41:20 +02:00

Merge branch 'PHP-8.2'

This commit is contained in:
Derick Rethans
2022-11-30 15:56:01 +00:00
10 changed files with 186 additions and 110 deletions

View File

@@ -62,7 +62,7 @@ static void sort_old_to_new(timelib_time **one, timelib_time **two, timelib_rel_
if (
(*one)->zone_type == TIMELIB_ZONETYPE_ID &&
(*two)->zone_type == TIMELIB_ZONETYPE_ID &&
(strcmp((*one)->tz_info->name, (*two)->tz_info->name) != 0)
(strcmp((*one)->tz_info->name, (*two)->tz_info->name) == 0)
) {
if (
((*one)->y > (*two)->y) ||
@@ -198,7 +198,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
{
timelib_rel_time *rt;
if (one->zone_type == TIMELIB_ZONETYPE_ID && two->zone_type == TIMELIB_ZONETYPE_ID) {
if (one->zone_type == TIMELIB_ZONETYPE_ID && two->zone_type == TIMELIB_ZONETYPE_ID && strcmp(one->tz_info->name, two->tz_info->name) == 0) {
return timelib_diff_with_tzid(one, two);
}

View File

@@ -1,4 +1,4 @@
/* Generated by re2c 0.15.3 on Wed Sep 14 16:31:52 2022 */
/* Generated by re2c 0.15.3 on Wed Nov 30 15:55:25 2022 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@@ -782,7 +782,12 @@ static timelib_long timelib_lookup_abbr(const char **ptr, int *dst, char **tz_ab
timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
/* Only include A-Z, a-z, /, _, and - in abbreviations/TZ IDs */
while (
(**ptr >= 'A' && **ptr <= 'Z') ||
(**ptr >= 'a' && **ptr <= 'z') ||
**ptr == '/' || **ptr == '_' || **ptr == '-'
) {
++*ptr;
}
end = *ptr;
@@ -978,11 +983,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 1109 "ext/date/lib/parse_date.re"
#line 1114 "ext/date/lib/parse_date.re"
#line 986 "<stdout>"
#line 991 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1120,7 +1125,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1843 "ext/date/lib/parse_date.re"
#line 1848 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1133,7 +1138,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1137 "<stdout>"
#line 1142 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1440,12 +1445,12 @@ yy11:
if (yych <= '9') goto yy1483;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1938 "ext/date/lib/parse_date.re"
#line 1943 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
#line 1449 "<stdout>"
#line 1454 "<stdout>"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2689,11 +2694,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1927 "ext/date/lib/parse_date.re"
#line 1932 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2697 "<stdout>"
#line 2702 "<stdout>"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2702,12 +2707,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1932 "ext/date/lib/parse_date.re"
#line 1937 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2711 "<stdout>"
#line 2716 "<stdout>"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3129,7 +3134,7 @@ yy83:
if (yych == 's') goto yy85;
yy84:
YYDEBUG(84, *YYCURSOR);
#line 1911 "ext/date/lib/parse_date.re"
#line 1916 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -3144,7 +3149,7 @@ yy84:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 3148 "<stdout>"
#line 3153 "<stdout>"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4153,7 +4158,7 @@ yy218:
}
yy219:
YYDEBUG(219, *YYCURSOR);
#line 1774 "ext/date/lib/parse_date.re"
#line 1779 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -4170,7 +4175,7 @@ yy219:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 4174 "<stdout>"
#line 4179 "<stdout>"
yy220:
YYDEBUG(220, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4716,7 +4721,7 @@ yy247:
}
yy248:
YYDEBUG(248, *YYCURSOR);
#line 1833 "ext/date/lib/parse_date.re"
#line 1838 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4725,7 +4730,7 @@ yy248:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4729 "<stdout>"
#line 4734 "<stdout>"
yy249:
YYDEBUG(249, *YYCURSOR);
++YYCURSOR;
@@ -4974,7 +4979,7 @@ yy261:
goto yy267;
yy262:
YYDEBUG(262, *YYCURSOR);
#line 1579 "ext/date/lib/parse_date.re"
#line 1584 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4987,7 +4992,7 @@ yy262:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4991 "<stdout>"
#line 4996 "<stdout>"
yy263:
YYDEBUG(263, *YYCURSOR);
yyaccept = 6;
@@ -5114,7 +5119,7 @@ yy275:
}
yy276:
YYDEBUG(276, *YYCURSOR);
#line 1881 "ext/date/lib/parse_date.re"
#line 1886 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -5143,7 +5148,7 @@ yy276:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5147 "<stdout>"
#line 5152 "<stdout>"
yy277:
YYDEBUG(277, *YYCURSOR);
yyaccept = 7;
@@ -5441,7 +5446,7 @@ yy300:
YYDEBUG(300, *YYCURSOR);
++YYCURSOR;
YYDEBUG(301, *YYCURSOR);
#line 1857 "ext/date/lib/parse_date.re"
#line 1862 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5464,7 +5469,7 @@ yy300:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5468 "<stdout>"
#line 5473 "<stdout>"
yy302:
YYDEBUG(302, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6142,7 +6147,7 @@ yy361:
YYDEBUG(362, *YYCURSOR);
++YYCURSOR;
YYDEBUG(363, *YYCURSOR);
#line 1551 "ext/date/lib/parse_date.re"
#line 1556 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -6155,7 +6160,7 @@ yy361:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 6159 "<stdout>"
#line 6164 "<stdout>"
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6386,7 +6391,7 @@ yy368:
if (yych <= '9') goto yy372;
yy371:
YYDEBUG(371, *YYCURSOR);
#line 1695 "ext/date/lib/parse_date.re"
#line 1700 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6399,7 +6404,7 @@ yy371:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6403 "<stdout>"
#line 6408 "<stdout>"
yy372:
YYDEBUG(372, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6981,7 +6986,7 @@ yy397:
}
yy398:
YYDEBUG(398, *YYCURSOR);
#line 1753 "ext/date/lib/parse_date.re"
#line 1758 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -7001,7 +7006,7 @@ yy398:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 7005 "<stdout>"
#line 7010 "<stdout>"
yy399:
YYDEBUG(399, *YYCURSOR);
yyaccept = 5;
@@ -8790,7 +8795,7 @@ yy460:
++YYCURSOR;
yy461:
YYDEBUG(461, *YYCURSOR);
#line 1444 "ext/date/lib/parse_date.re"
#line 1449 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -8801,7 +8806,7 @@ yy461:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8805 "<stdout>"
#line 8810 "<stdout>"
yy462:
YYDEBUG(462, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8923,7 +8928,7 @@ yy484:
YYDEBUG(484, *YYCURSOR);
++YYCURSOR;
YYDEBUG(485, *YYCURSOR);
#line 1470 "ext/date/lib/parse_date.re"
#line 1475 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@@ -8934,7 +8939,7 @@ yy484:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8938 "<stdout>"
#line 8943 "<stdout>"
yy486:
YYDEBUG(486, *YYCURSOR);
yyaccept = 1;
@@ -9688,7 +9693,7 @@ yy508:
}
yy509:
YYDEBUG(509, *YYCURSOR);
#line 1593 "ext/date/lib/parse_date.re"
#line 1598 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9699,7 +9704,7 @@ yy509:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9703 "<stdout>"
#line 9708 "<stdout>"
yy510:
YYDEBUG(510, *YYCURSOR);
yyaccept = 9;
@@ -9840,7 +9845,7 @@ yy521:
YYDEBUG(521, *YYCURSOR);
++YYCURSOR;
YYDEBUG(522, *YYCURSOR);
#line 1297 "ext/date/lib/parse_date.re"
#line 1302 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9856,7 +9861,7 @@ yy521:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9860 "<stdout>"
#line 9865 "<stdout>"
yy523:
YYDEBUG(523, *YYCURSOR);
yyaccept = 10;
@@ -9869,7 +9874,7 @@ yy523:
}
yy524:
YYDEBUG(524, *YYCURSOR);
#line 1334 "ext/date/lib/parse_date.re"
#line 1339 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@@ -9896,7 +9901,7 @@ yy524:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9900 "<stdout>"
#line 9905 "<stdout>"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 10;
@@ -10209,7 +10214,7 @@ yy556:
YYDEBUG(556, *YYCURSOR);
++YYCURSOR;
YYDEBUG(557, *YYCURSOR);
#line 1314 "ext/date/lib/parse_date.re"
#line 1319 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10228,7 +10233,7 @@ yy556:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10232 "<stdout>"
#line 10237 "<stdout>"
yy558:
YYDEBUG(558, *YYCURSOR);
yyaccept = 10;
@@ -10334,7 +10339,7 @@ yy567:
if (yych <= '9') goto yy574;
yy568:
YYDEBUG(568, *YYCURSOR);
#line 1510 "ext/date/lib/parse_date.re"
#line 1515 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10348,7 +10353,7 @@ yy568:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10352 "<stdout>"
#line 10357 "<stdout>"
yy569:
YYDEBUG(569, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11084,7 +11089,7 @@ yy638:
YYDEBUG(639, *YYCURSOR);
++YYCURSOR;
YYDEBUG(640, *YYCURSOR);
#line 1525 "ext/date/lib/parse_date.re"
#line 1530 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11095,7 +11100,7 @@ yy638:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11099 "<stdout>"
#line 11104 "<stdout>"
yy641:
YYDEBUG(641, *YYCURSOR);
yyaccept = 10;
@@ -11131,7 +11136,7 @@ yy644:
if (yych <= '9') goto yy638;
yy645:
YYDEBUG(645, *YYCURSOR);
#line 1537 "ext/date/lib/parse_date.re"
#line 1542 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11144,7 +11149,7 @@ yy645:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11148 "<stdout>"
#line 11153 "<stdout>"
yy646:
YYDEBUG(646, *YYCURSOR);
yyaccept = 10;
@@ -11785,7 +11790,7 @@ yy689:
}
yy690:
YYDEBUG(690, *YYCURSOR);
#line 1496 "ext/date/lib/parse_date.re"
#line 1501 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11798,7 +11803,7 @@ yy690:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11802 "<stdout>"
#line 11807 "<stdout>"
yy691:
YYDEBUG(691, *YYCURSOR);
yyaccept = 12;
@@ -11904,7 +11909,7 @@ yy699:
}
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1428 "ext/date/lib/parse_date.re"
#line 1433 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11919,7 +11924,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11923 "<stdout>"
#line 11928 "<stdout>"
yy701:
YYDEBUG(701, *YYCURSOR);
yyaccept = 13;
@@ -12153,7 +12158,7 @@ yy733:
if (yych <= ':') goto yy737;
yy734:
YYDEBUG(734, *YYCURSOR);
#line 1723 "ext/date/lib/parse_date.re"
#line 1728 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12173,7 +12178,7 @@ yy734:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12177 "<stdout>"
#line 12182 "<stdout>"
yy735:
YYDEBUG(735, *YYCURSOR);
yyaccept = 14;
@@ -12793,7 +12798,7 @@ yy807:
}
yy808:
YYDEBUG(808, *YYCURSOR);
#line 1456 "ext/date/lib/parse_date.re"
#line 1461 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12806,7 +12811,7 @@ yy808:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12810 "<stdout>"
#line 12815 "<stdout>"
yy809:
YYDEBUG(809, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12845,7 +12850,7 @@ yy815:
YYDEBUG(815, *YYCURSOR);
++YYCURSOR;
YYDEBUG(816, *YYCURSOR);
#line 1709 "ext/date/lib/parse_date.re"
#line 1714 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12858,7 +12863,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12862 "<stdout>"
#line 12867 "<stdout>"
yy817:
YYDEBUG(817, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13023,7 +13028,7 @@ yy827:
}
yy828:
YYDEBUG(828, *YYCURSOR);
#line 1744 "ext/date/lib/parse_date.re"
#line 1749 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -13031,7 +13036,7 @@ yy828:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 13035 "<stdout>"
#line 13040 "<stdout>"
yy829:
YYDEBUG(829, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13236,7 +13241,7 @@ yy837:
}
yy838:
YYDEBUG(838, *YYCURSOR);
#line 1565 "ext/date/lib/parse_date.re"
#line 1570 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13249,7 +13254,7 @@ yy838:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 13253 "<stdout>"
#line 13258 "<stdout>"
yy839:
YYDEBUG(839, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13470,7 +13475,7 @@ yy858:
if (yych <= '7') goto yy861;
yy859:
YYDEBUG(859, *YYCURSOR);
#line 1676 "ext/date/lib/parse_date.re"
#line 1681 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13488,7 +13493,7 @@ yy859:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13492 "<stdout>"
#line 13497 "<stdout>"
yy860:
YYDEBUG(860, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13498,7 +13503,7 @@ yy861:
YYDEBUG(861, *YYCURSOR);
++YYCURSOR;
YYDEBUG(862, *YYCURSOR);
#line 1657 "ext/date/lib/parse_date.re"
#line 1662 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13516,7 +13521,7 @@ yy861:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13520 "<stdout>"
#line 13525 "<stdout>"
yy863:
YYDEBUG(863, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13588,7 +13593,7 @@ yy865:
}
yy866:
YYDEBUG(866, *YYCURSOR);
#line 1643 "ext/date/lib/parse_date.re"
#line 1648 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13601,7 +13606,7 @@ yy866:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13605 "<stdout>"
#line 13610 "<stdout>"
yy867:
YYDEBUG(867, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13704,7 +13709,7 @@ yy886:
++YYCURSOR;
yy887:
YYDEBUG(887, *YYCURSOR);
#line 1617 "ext/date/lib/parse_date.re"
#line 1622 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13729,7 +13734,7 @@ yy887:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13733 "<stdout>"
#line 13738 "<stdout>"
yy888:
YYDEBUG(888, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14025,7 +14030,7 @@ yy892:
}
yy893:
YYDEBUG(893, *YYCURSOR);
#line 1605 "ext/date/lib/parse_date.re"
#line 1610 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -14036,7 +14041,7 @@ yy893:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 14040 "<stdout>"
#line 14045 "<stdout>"
yy894:
YYDEBUG(894, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14958,7 +14963,7 @@ yy1017:
}
yy1018:
YYDEBUG(1018, *YYCURSOR);
#line 1482 "ext/date/lib/parse_date.re"
#line 1487 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14971,7 +14976,7 @@ yy1018:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14975 "<stdout>"
#line 14980 "<stdout>"
yy1019:
YYDEBUG(1019, *YYCURSOR);
yyaccept = 22;
@@ -16179,7 +16184,7 @@ yy1125:
}
yy1127:
YYDEBUG(1127, *YYCURSOR);
#line 1362 "ext/date/lib/parse_date.re"
#line 1367 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -16201,7 +16206,7 @@ yy1127:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 16205 "<stdout>"
#line 16210 "<stdout>"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16301,7 +16306,7 @@ yy1134:
}
yy1135:
YYDEBUG(1135, *YYCURSOR);
#line 1408 "ext/date/lib/parse_date.re"
#line 1413 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -16320,7 +16325,7 @@ yy1135:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 16324 "<stdout>"
#line 16329 "<stdout>"
yy1136:
YYDEBUG(1136, *YYCURSOR);
yyaccept = 25;
@@ -17296,7 +17301,7 @@ yy1178:
}
yy1179:
YYDEBUG(1179, *YYCURSOR);
#line 1816 "ext/date/lib/parse_date.re"
#line 1821 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17312,7 +17317,7 @@ yy1179:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17316 "<stdout>"
#line 17321 "<stdout>"
yy1180:
YYDEBUG(1180, *YYCURSOR);
++YYCURSOR;
@@ -17378,7 +17383,7 @@ yy1188:
YYDEBUG(1188, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1189, *YYCURSOR);
#line 1275 "ext/date/lib/parse_date.re"
#line 1280 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17399,7 +17404,7 @@ yy1188:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 17403 "<stdout>"
#line 17408 "<stdout>"
yy1190:
YYDEBUG(1190, *YYCURSOR);
yyaccept = 26;
@@ -17539,7 +17544,7 @@ yy1205:
}
yy1206:
YYDEBUG(1206, *YYCURSOR);
#line 1792 "ext/date/lib/parse_date.re"
#line 1797 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17562,7 +17567,7 @@ yy1206:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17566 "<stdout>"
#line 17571 "<stdout>"
yy1207:
YYDEBUG(1207, *YYCURSOR);
yych = *++YYCURSOR;
@@ -20511,7 +20516,7 @@ yy1387:
}
yy1388:
YYDEBUG(1388, *YYCURSOR);
#line 1252 "ext/date/lib/parse_date.re"
#line 1257 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -20533,7 +20538,7 @@ yy1388:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20537 "<stdout>"
#line 20542 "<stdout>"
yy1389:
YYDEBUG(1389, *YYCURSOR);
yyaccept = 28;
@@ -20832,7 +20837,7 @@ yy1410:
YYDEBUG(1410, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1411, *YYCURSOR);
#line 1235 "ext/date/lib/parse_date.re"
#line 1240 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -20848,7 +20853,7 @@ yy1410:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20852 "<stdout>"
#line 20857 "<stdout>"
yy1412:
YYDEBUG(1412, *YYCURSOR);
yyaccept = 1;
@@ -22370,7 +22375,7 @@ yy1483:
if (yych <= '9') goto yy1483;
yy1485:
YYDEBUG(1485, *YYCURSOR);
#line 1169 "ext/date/lib/parse_date.re"
#line 1174 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -22395,7 +22400,7 @@ yy1485:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22399 "<stdout>"
#line 22404 "<stdout>"
yy1486:
YYDEBUG(1486, *YYCURSOR);
++YYCURSOR;
@@ -22403,7 +22408,7 @@ yy1486:
if (yych <= '9') goto yy1488;
yy1487:
YYDEBUG(1487, *YYCURSOR);
#line 1195 "ext/date/lib/parse_date.re"
#line 1200 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@@ -22442,7 +22447,7 @@ yy1487:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22446 "<stdout>"
#line 22451 "<stdout>"
yy1488:
YYDEBUG(1488, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22911,7 +22916,7 @@ yy1523:
++YYCURSOR;
yy1524:
YYDEBUG(1524, *YYCURSOR);
#line 1157 "ext/date/lib/parse_date.re"
#line 1162 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -22922,7 +22927,7 @@ yy1524:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22926 "<stdout>"
#line 22931 "<stdout>"
yy1525:
YYDEBUG(1525, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22957,7 +22962,7 @@ yy1526:
}
yy1527:
YYDEBUG(1527, *YYCURSOR);
#line 1147 "ext/date/lib/parse_date.re"
#line 1152 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -22966,7 +22971,7 @@ yy1527:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22970 "<stdout>"
#line 22975 "<stdout>"
yy1528:
YYDEBUG(1528, *YYCURSOR);
yych = *++YYCURSOR;
@@ -25061,7 +25066,7 @@ yy1611:
}
yy1612:
YYDEBUG(1612, *YYCURSOR);
#line 1126 "ext/date/lib/parse_date.re"
#line 1131 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -25069,7 +25074,7 @@ yy1612:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25073 "<stdout>"
#line 25078 "<stdout>"
yy1613:
YYDEBUG(1613, *YYCURSOR);
yych = *++YYCURSOR;
@@ -25208,7 +25213,7 @@ yy1619:
}
yy1620:
YYDEBUG(1620, *YYCURSOR);
#line 1135 "ext/date/lib/parse_date.re"
#line 1140 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -25219,7 +25224,7 @@ yy1620:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25223 "<stdout>"
#line 25228 "<stdout>"
yy1621:
YYDEBUG(1621, *YYCURSOR);
yyaccept = 1;
@@ -25752,7 +25757,7 @@ yy1642:
++YYCURSOR;
yy1643:
YYDEBUG(1643, *YYCURSOR);
#line 1114 "ext/date/lib/parse_date.re"
#line 1119 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -25763,7 +25768,7 @@ yy1643:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25767 "<stdout>"
#line 25772 "<stdout>"
yy1644:
YYDEBUG(1644, *YYCURSOR);
yyaccept = 1;
@@ -25936,7 +25941,7 @@ yy1649:
goto yy1643;
}
}
#line 1942 "ext/date/lib/parse_date.re"
#line 1947 "ext/date/lib/parse_date.re"
}

View File

@@ -780,7 +780,12 @@ static timelib_long timelib_lookup_abbr(const char **ptr, int *dst, char **tz_ab
timelib_long value = 0;
const timelib_tz_lookup_table *tp;
while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
/* Only include A-Z, a-z, /, _, and - in abbreviations/TZ IDs */
while (
(**ptr >= 'A' && **ptr <= 'Z') ||
(**ptr >= 'a' && **ptr <= 'z') ||
**ptr == '/' || **ptr == '_' || **ptr == '-'
) {
++*ptr;
}
end = *ptr;

View File

@@ -19,7 +19,7 @@ DateInterval Object
[i] => 0
[s] => 0
[f] => 0
[invert] => 0
[invert] => 1
[days] => 0
[from_string] =>
)
@@ -32,7 +32,6 @@ DateInterval Object
[i] => 0
[s] => 0
[f] => 0
[invert] => 1
[days] => 0
[from_string] =>
)

View File

@@ -1,5 +1,5 @@
--TEST--
GH-7758 (Problems with negative timestamps and fractions)
Bug GH-7758 (Problems with negative timestamps and fractions)
--FILE--
<?php
date_default_timezone_set('UTC');

View File

@@ -0,0 +1,12 @@
--TEST--
Bug GH-9699 (DateTimeImmutable::diff differences in 8.1.10 onwards - timezone related)
--FILE--
<?php
$date = new DateTimeImmutable('2022-10-09 02:41:54.515330', new DateTimeZone('America/Los_Angeles'));
$now = new DateTimeImmutable('2022-10-10 08:41:54.534620', new DateTimeZone('UTC'));
echo $date->diff($now)->format("%R %Y %M %D %H %I %S %F"), "\n";
?>
--EXPECT--
+ 00 00 00 23 00 00 019290

View File

@@ -0,0 +1,15 @@
--TEST--
Bug GH-9700 (DateTime::createFromFormat: Parsing TZID string is too greedy)
--FILE--
<?php
var_dump(DateTime::createFromFormat('Y-m-d\TH:i:sP[e]', '2022-02-18T00:00:00+01:00[Europe/Berlin]'));
?>
--EXPECTF--
object(DateTime)#%d (%d) {
["date"]=>
string(26) "2022-02-18 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Berlin"
}

View File

@@ -0,0 +1,22 @@
--TEST--
Bug GH-9866 (Time zone bug with \DateTimeInterface::diff())
--FILE--
<?php
function getYearsBetween(
\DateTimeImmutable $startDate,
\DateTimeImmutable $endDate,
): int {
$dateInterval = $startDate->diff($endDate, true);
return $dateInterval->y;
}
$start = new \DateTimeImmutable('2000-11-01 09:29:22.907606', new \DateTimeZone('America/Chicago'));
$end = new \DateTimeImmutable('2022-06-06 11:00:00.000000', new \DateTimeZone('America/New_York'));
$result = getYearsBetween($start, $end);
var_dump($result);
$diff = $start->diff($end);
echo $diff->format("%R %Y %M %D (%a) %H %I %S %F"), "\n";
?>
--EXPECT--
int(21)
+ 21 07 04 (7886) 23 30 37 092394

View File

@@ -0,0 +1,18 @@
--TEST--
Bug GH-9880 (DateTime diff returns wrong sign on day count when using a timezone)
--FILE--
<?php
ini_set('date.timezone', 'America/Los_Angeles');
$nowTime = new DateTime();
$nowTime->setTimestamp(1667416695);
$dateTime = new DateTime();
$dateTime->setTimestamp(1671904800);
$dateTime->setTimezone(new DateTimeZone('America/New_York'));
echo $dateTime->diff($nowTime)->format('%R %a %H %I %S'), "\n";
?>
--EXPECT--
- 51 22 41 45

View File

@@ -54,7 +54,7 @@ echo 'bd8b ' . $end->format($date_format) . ' - ' . $start->format($date_format)
echo "\n";
?>
--EXPECT--
bd0 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = P0DT0H0M1S
bd0 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = P0DT0H59M59S
bd5 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT22H
bd6 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT21H
bd8a 2010-11-07 01:00:00 EST America/New_York - 2010-11-06 01:00:00 EDT America/New_York = P1DT0H