1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 00:18:23 +02:00

Merge remote-tracking branch 'derickr/timelib-2021.18' into PHP-8.1

This commit is contained in:
Derick Rethans
2022-11-30 15:53:52 +00:00
13 changed files with 199 additions and 113 deletions
+9
View File
@@ -10,6 +10,15 @@ PHP NEWS
. Fixed bug GH-9650 (Can't initialize heap: [0x000001e7]). (Michael Voříšek)
. Fixed potentially undefined behavior in Windows ftok(3) emulation. (cmb)
- Date:
. Fixed bug GH-9699 (DateTimeImmutable::diff differences in 8.1.10 onwards -
timezone related). (Derick)
. Fixed bug GH-9700 (DateTime::createFromFormat: Parsing TZID string is too
greedy). (Derick)
. Fixed bug GH-9866 (Time zone bug with \DateTimeInterface::diff()). (Derick)
. Fixed bug GH-9880 (DateTime diff returns wrong sign on day count when using
a timezone). (Derick)
- FPM:
. Fixed bug GH-9959 (Solaris port event mechanism is still broken after bug
#66694). (Petr Sumbera)
+2 -2
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) ||
@@ -200,7 +200,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);
}
+108 -103
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.15.3 on Wed Sep 14 10:36:03 2022 */
/* Generated by re2c 0.15.3 on Wed Nov 30 11:53:33 2022 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@@ -756,7 +756,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;
@@ -952,11 +957,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 1083 "ext/date/lib/parse_date.re"
#line 1088 "ext/date/lib/parse_date.re"
#line 960 "<stdout>"
#line 965 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -1094,7 +1099,7 @@ yy2:
}
yy3:
YYDEBUG(3, *YYCURSOR);
#line 1817 "ext/date/lib/parse_date.re"
#line 1822 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1107,7 +1112,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 1111 "<stdout>"
#line 1116 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -1414,12 +1419,12 @@ yy11:
if (yych <= '9') goto yy1483;
yy12:
YYDEBUG(12, *YYCURSOR);
#line 1912 "ext/date/lib/parse_date.re"
#line 1917 "ext/date/lib/parse_date.re"
{
add_error(s, TIMELIB_ERR_UNEXPECTED_CHARACTER, "Unexpected character");
goto std;
}
#line 1423 "<stdout>"
#line 1428 "<stdout>"
yy13:
YYDEBUG(13, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2663,11 +2668,11 @@ yy48:
if (yych <= '9') goto yy54;
yy49:
YYDEBUG(49, *YYCURSOR);
#line 1901 "ext/date/lib/parse_date.re"
#line 1906 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2671 "<stdout>"
#line 2676 "<stdout>"
yy50:
YYDEBUG(50, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2676,12 +2681,12 @@ yy51:
YYDEBUG(51, *YYCURSOR);
++YYCURSOR;
YYDEBUG(52, *YYCURSOR);
#line 1906 "ext/date/lib/parse_date.re"
#line 1911 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2685 "<stdout>"
#line 2690 "<stdout>"
yy53:
YYDEBUG(53, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3103,7 +3108,7 @@ yy83:
if (yych == 's') goto yy85;
yy84:
YYDEBUG(84, *YYCURSOR);
#line 1885 "ext/date/lib/parse_date.re"
#line 1890 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -3118,7 +3123,7 @@ yy84:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 3122 "<stdout>"
#line 3127 "<stdout>"
yy85:
YYDEBUG(85, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4127,7 +4132,7 @@ yy218:
}
yy219:
YYDEBUG(219, *YYCURSOR);
#line 1748 "ext/date/lib/parse_date.re"
#line 1753 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -4144,7 +4149,7 @@ yy219:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 4148 "<stdout>"
#line 4153 "<stdout>"
yy220:
YYDEBUG(220, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4690,7 +4695,7 @@ yy247:
}
yy248:
YYDEBUG(248, *YYCURSOR);
#line 1807 "ext/date/lib/parse_date.re"
#line 1812 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4699,7 +4704,7 @@ yy248:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4703 "<stdout>"
#line 4708 "<stdout>"
yy249:
YYDEBUG(249, *YYCURSOR);
++YYCURSOR;
@@ -4948,7 +4953,7 @@ yy261:
goto yy267;
yy262:
YYDEBUG(262, *YYCURSOR);
#line 1553 "ext/date/lib/parse_date.re"
#line 1558 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4961,7 +4966,7 @@ yy262:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 4965 "<stdout>"
#line 4970 "<stdout>"
yy263:
YYDEBUG(263, *YYCURSOR);
yyaccept = 6;
@@ -5088,7 +5093,7 @@ yy275:
}
yy276:
YYDEBUG(276, *YYCURSOR);
#line 1855 "ext/date/lib/parse_date.re"
#line 1860 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -5117,7 +5122,7 @@ yy276:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5121 "<stdout>"
#line 5126 "<stdout>"
yy277:
YYDEBUG(277, *YYCURSOR);
yyaccept = 7;
@@ -5415,7 +5420,7 @@ yy300:
YYDEBUG(300, *YYCURSOR);
++YYCURSOR;
YYDEBUG(301, *YYCURSOR);
#line 1831 "ext/date/lib/parse_date.re"
#line 1836 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5438,7 +5443,7 @@ yy300:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 5442 "<stdout>"
#line 5447 "<stdout>"
yy302:
YYDEBUG(302, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6116,7 +6121,7 @@ yy361:
YYDEBUG(362, *YYCURSOR);
++YYCURSOR;
YYDEBUG(363, *YYCURSOR);
#line 1525 "ext/date/lib/parse_date.re"
#line 1530 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -6129,7 +6134,7 @@ yy361:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 6133 "<stdout>"
#line 6138 "<stdout>"
yy364:
YYDEBUG(364, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6360,7 +6365,7 @@ yy368:
if (yych <= '9') goto yy372;
yy371:
YYDEBUG(371, *YYCURSOR);
#line 1669 "ext/date/lib/parse_date.re"
#line 1674 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6373,7 +6378,7 @@ yy371:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6377 "<stdout>"
#line 6382 "<stdout>"
yy372:
YYDEBUG(372, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6955,7 +6960,7 @@ yy397:
}
yy398:
YYDEBUG(398, *YYCURSOR);
#line 1727 "ext/date/lib/parse_date.re"
#line 1732 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -6975,7 +6980,7 @@ yy398:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 6979 "<stdout>"
#line 6984 "<stdout>"
yy399:
YYDEBUG(399, *YYCURSOR);
yyaccept = 5;
@@ -8764,7 +8769,7 @@ yy460:
++YYCURSOR;
yy461:
YYDEBUG(461, *YYCURSOR);
#line 1418 "ext/date/lib/parse_date.re"
#line 1423 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -8775,7 +8780,7 @@ yy461:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8779 "<stdout>"
#line 8784 "<stdout>"
yy462:
YYDEBUG(462, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8897,7 +8902,7 @@ yy484:
YYDEBUG(484, *YYCURSOR);
++YYCURSOR;
YYDEBUG(485, *YYCURSOR);
#line 1444 "ext/date/lib/parse_date.re"
#line 1449 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601datex");
TIMELIB_INIT;
@@ -8908,7 +8913,7 @@ yy484:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8912 "<stdout>"
#line 8917 "<stdout>"
yy486:
YYDEBUG(486, *YYCURSOR);
yyaccept = 1;
@@ -9662,7 +9667,7 @@ yy508:
}
yy509:
YYDEBUG(509, *YYCURSOR);
#line 1567 "ext/date/lib/parse_date.re"
#line 1572 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9673,7 +9678,7 @@ yy509:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9677 "<stdout>"
#line 9682 "<stdout>"
yy510:
YYDEBUG(510, *YYCURSOR);
yyaccept = 9;
@@ -9814,7 +9819,7 @@ yy521:
YYDEBUG(521, *YYCURSOR);
++YYCURSOR;
YYDEBUG(522, *YYCURSOR);
#line 1271 "ext/date/lib/parse_date.re"
#line 1276 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9830,7 +9835,7 @@ yy521:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9834 "<stdout>"
#line 9839 "<stdout>"
yy523:
YYDEBUG(523, *YYCURSOR);
yyaccept = 10;
@@ -9843,7 +9848,7 @@ yy523:
}
yy524:
YYDEBUG(524, *YYCURSOR);
#line 1308 "ext/date/lib/parse_date.re"
#line 1313 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timetiny24 | timeshort24 | timelong24 | iso8601long");
@@ -9870,7 +9875,7 @@ yy524:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9874 "<stdout>"
#line 9879 "<stdout>"
yy525:
YYDEBUG(525, *YYCURSOR);
yyaccept = 10;
@@ -10183,7 +10188,7 @@ yy556:
YYDEBUG(556, *YYCURSOR);
++YYCURSOR;
YYDEBUG(557, *YYCURSOR);
#line 1288 "ext/date/lib/parse_date.re"
#line 1293 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10202,7 +10207,7 @@ yy556:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 10206 "<stdout>"
#line 10211 "<stdout>"
yy558:
YYDEBUG(558, *YYCURSOR);
yyaccept = 10;
@@ -10308,7 +10313,7 @@ yy567:
if (yych <= '9') goto yy574;
yy568:
YYDEBUG(568, *YYCURSOR);
#line 1484 "ext/date/lib/parse_date.re"
#line 1489 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -10322,7 +10327,7 @@ yy568:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 10326 "<stdout>"
#line 10331 "<stdout>"
yy569:
YYDEBUG(569, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11058,7 +11063,7 @@ yy638:
YYDEBUG(639, *YYCURSOR);
++YYCURSOR;
YYDEBUG(640, *YYCURSOR);
#line 1499 "ext/date/lib/parse_date.re"
#line 1504 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11069,7 +11074,7 @@ yy638:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11073 "<stdout>"
#line 11078 "<stdout>"
yy641:
YYDEBUG(641, *YYCURSOR);
yyaccept = 10;
@@ -11105,7 +11110,7 @@ yy644:
if (yych <= '9') goto yy638;
yy645:
YYDEBUG(645, *YYCURSOR);
#line 1511 "ext/date/lib/parse_date.re"
#line 1516 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11118,7 +11123,7 @@ yy645:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 11122 "<stdout>"
#line 11127 "<stdout>"
yy646:
YYDEBUG(646, *YYCURSOR);
yyaccept = 10;
@@ -11759,7 +11764,7 @@ yy689:
}
yy690:
YYDEBUG(690, *YYCURSOR);
#line 1470 "ext/date/lib/parse_date.re"
#line 1475 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11772,7 +11777,7 @@ yy690:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11776 "<stdout>"
#line 11781 "<stdout>"
yy691:
YYDEBUG(691, *YYCURSOR);
yyaccept = 12;
@@ -11878,7 +11883,7 @@ yy699:
}
yy700:
YYDEBUG(700, *YYCURSOR);
#line 1402 "ext/date/lib/parse_date.re"
#line 1407 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11893,7 +11898,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11897 "<stdout>"
#line 11902 "<stdout>"
yy701:
YYDEBUG(701, *YYCURSOR);
yyaccept = 13;
@@ -12127,7 +12132,7 @@ yy733:
if (yych <= ':') goto yy737;
yy734:
YYDEBUG(734, *YYCURSOR);
#line 1697 "ext/date/lib/parse_date.re"
#line 1702 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12147,7 +12152,7 @@ yy734:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12151 "<stdout>"
#line 12156 "<stdout>"
yy735:
YYDEBUG(735, *YYCURSOR);
yyaccept = 14;
@@ -12767,7 +12772,7 @@ yy807:
}
yy808:
YYDEBUG(808, *YYCURSOR);
#line 1430 "ext/date/lib/parse_date.re"
#line 1435 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12780,7 +12785,7 @@ yy808:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 12784 "<stdout>"
#line 12789 "<stdout>"
yy809:
YYDEBUG(809, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12819,7 +12824,7 @@ yy815:
YYDEBUG(815, *YYCURSOR);
++YYCURSOR;
YYDEBUG(816, *YYCURSOR);
#line 1683 "ext/date/lib/parse_date.re"
#line 1688 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12832,7 +12837,7 @@ yy815:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 12836 "<stdout>"
#line 12841 "<stdout>"
yy817:
YYDEBUG(817, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12997,7 +13002,7 @@ yy827:
}
yy828:
YYDEBUG(828, *YYCURSOR);
#line 1718 "ext/date/lib/parse_date.re"
#line 1723 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -13005,7 +13010,7 @@ yy828:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 13009 "<stdout>"
#line 13014 "<stdout>"
yy829:
YYDEBUG(829, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13210,7 +13215,7 @@ yy837:
}
yy838:
YYDEBUG(838, *YYCURSOR);
#line 1539 "ext/date/lib/parse_date.re"
#line 1544 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13223,7 +13228,7 @@ yy838:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 13227 "<stdout>"
#line 13232 "<stdout>"
yy839:
YYDEBUG(839, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13444,7 +13449,7 @@ yy858:
if (yych <= '7') goto yy861;
yy859:
YYDEBUG(859, *YYCURSOR);
#line 1650 "ext/date/lib/parse_date.re"
#line 1655 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13462,7 +13467,7 @@ yy859:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13466 "<stdout>"
#line 13471 "<stdout>"
yy860:
YYDEBUG(860, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13472,7 +13477,7 @@ yy861:
YYDEBUG(861, *YYCURSOR);
++YYCURSOR;
YYDEBUG(862, *YYCURSOR);
#line 1631 "ext/date/lib/parse_date.re"
#line 1636 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13490,7 +13495,7 @@ yy861:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 13494 "<stdout>"
#line 13499 "<stdout>"
yy863:
YYDEBUG(863, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13562,7 +13567,7 @@ yy865:
}
yy866:
YYDEBUG(866, *YYCURSOR);
#line 1617 "ext/date/lib/parse_date.re"
#line 1622 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13575,7 +13580,7 @@ yy866:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 13579 "<stdout>"
#line 13584 "<stdout>"
yy867:
YYDEBUG(867, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13678,7 +13683,7 @@ yy886:
++YYCURSOR;
yy887:
YYDEBUG(887, *YYCURSOR);
#line 1591 "ext/date/lib/parse_date.re"
#line 1596 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13703,7 +13708,7 @@ yy887:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 13707 "<stdout>"
#line 13712 "<stdout>"
yy888:
YYDEBUG(888, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13999,7 +14004,7 @@ yy892:
}
yy893:
YYDEBUG(893, *YYCURSOR);
#line 1579 "ext/date/lib/parse_date.re"
#line 1584 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -14010,7 +14015,7 @@ yy893:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 14014 "<stdout>"
#line 14019 "<stdout>"
yy894:
YYDEBUG(894, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14932,7 +14937,7 @@ yy1017:
}
yy1018:
YYDEBUG(1018, *YYCURSOR);
#line 1456 "ext/date/lib/parse_date.re"
#line 1461 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -14945,7 +14950,7 @@ yy1018:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 14949 "<stdout>"
#line 14954 "<stdout>"
yy1019:
YYDEBUG(1019, *YYCURSOR);
yyaccept = 22;
@@ -16153,7 +16158,7 @@ yy1125:
}
yy1127:
YYDEBUG(1127, *YYCURSOR);
#line 1336 "ext/date/lib/parse_date.re"
#line 1341 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -16175,7 +16180,7 @@ yy1127:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 16179 "<stdout>"
#line 16184 "<stdout>"
yy1128:
YYDEBUG(1128, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16275,7 +16280,7 @@ yy1134:
}
yy1135:
YYDEBUG(1135, *YYCURSOR);
#line 1382 "ext/date/lib/parse_date.re"
#line 1387 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -16294,7 +16299,7 @@ yy1135:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 16298 "<stdout>"
#line 16303 "<stdout>"
yy1136:
YYDEBUG(1136, *YYCURSOR);
yyaccept = 25;
@@ -17270,7 +17275,7 @@ yy1178:
}
yy1179:
YYDEBUG(1179, *YYCURSOR);
#line 1790 "ext/date/lib/parse_date.re"
#line 1795 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17286,7 +17291,7 @@ yy1179:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17290 "<stdout>"
#line 17295 "<stdout>"
yy1180:
YYDEBUG(1180, *YYCURSOR);
++YYCURSOR;
@@ -17352,7 +17357,7 @@ yy1188:
YYDEBUG(1188, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1189, *YYCURSOR);
#line 1249 "ext/date/lib/parse_date.re"
#line 1254 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17373,7 +17378,7 @@ yy1188:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 17377 "<stdout>"
#line 17382 "<stdout>"
yy1190:
YYDEBUG(1190, *YYCURSOR);
yyaccept = 26;
@@ -17513,7 +17518,7 @@ yy1205:
}
yy1206:
YYDEBUG(1206, *YYCURSOR);
#line 1766 "ext/date/lib/parse_date.re"
#line 1771 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -17536,7 +17541,7 @@ yy1206:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 17540 "<stdout>"
#line 17545 "<stdout>"
yy1207:
YYDEBUG(1207, *YYCURSOR);
yych = *++YYCURSOR;
@@ -20485,7 +20490,7 @@ yy1387:
}
yy1388:
YYDEBUG(1388, *YYCURSOR);
#line 1226 "ext/date/lib/parse_date.re"
#line 1231 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -20507,7 +20512,7 @@ yy1388:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20511 "<stdout>"
#line 20516 "<stdout>"
yy1389:
YYDEBUG(1389, *YYCURSOR);
yyaccept = 28;
@@ -20806,7 +20811,7 @@ yy1410:
YYDEBUG(1410, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1411, *YYCURSOR);
#line 1209 "ext/date/lib/parse_date.re"
#line 1214 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -20822,7 +20827,7 @@ yy1410:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 20826 "<stdout>"
#line 20831 "<stdout>"
yy1412:
YYDEBUG(1412, *YYCURSOR);
yyaccept = 1;
@@ -22344,7 +22349,7 @@ yy1483:
if (yych <= '9') goto yy1483;
yy1485:
YYDEBUG(1485, *YYCURSOR);
#line 1143 "ext/date/lib/parse_date.re"
#line 1148 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -22369,7 +22374,7 @@ yy1485:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22373 "<stdout>"
#line 22378 "<stdout>"
yy1486:
YYDEBUG(1486, *YYCURSOR);
++YYCURSOR;
@@ -22377,7 +22382,7 @@ yy1486:
if (yych <= '9') goto yy1488;
yy1487:
YYDEBUG(1487, *YYCURSOR);
#line 1169 "ext/date/lib/parse_date.re"
#line 1174 "ext/date/lib/parse_date.re"
{
timelib_sll i;
timelib_ull us;
@@ -22416,7 +22421,7 @@ yy1487:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22420 "<stdout>"
#line 22425 "<stdout>"
yy1488:
YYDEBUG(1488, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22885,7 +22890,7 @@ yy1523:
++YYCURSOR;
yy1524:
YYDEBUG(1524, *YYCURSOR);
#line 1131 "ext/date/lib/parse_date.re"
#line 1136 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -22896,7 +22901,7 @@ yy1524:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22900 "<stdout>"
#line 22905 "<stdout>"
yy1525:
YYDEBUG(1525, *YYCURSOR);
yych = *++YYCURSOR;
@@ -22931,7 +22936,7 @@ yy1526:
}
yy1527:
YYDEBUG(1527, *YYCURSOR);
#line 1121 "ext/date/lib/parse_date.re"
#line 1126 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -22940,7 +22945,7 @@ yy1527:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22944 "<stdout>"
#line 22949 "<stdout>"
yy1528:
YYDEBUG(1528, *YYCURSOR);
yych = *++YYCURSOR;
@@ -25035,7 +25040,7 @@ yy1611:
}
yy1612:
YYDEBUG(1612, *YYCURSOR);
#line 1100 "ext/date/lib/parse_date.re"
#line 1105 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -25043,7 +25048,7 @@ yy1612:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25047 "<stdout>"
#line 25052 "<stdout>"
yy1613:
YYDEBUG(1613, *YYCURSOR);
yych = *++YYCURSOR;
@@ -25182,7 +25187,7 @@ yy1619:
}
yy1620:
YYDEBUG(1620, *YYCURSOR);
#line 1109 "ext/date/lib/parse_date.re"
#line 1114 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -25193,7 +25198,7 @@ yy1620:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25197 "<stdout>"
#line 25202 "<stdout>"
yy1621:
YYDEBUG(1621, *YYCURSOR);
yyaccept = 1;
@@ -25726,7 +25731,7 @@ yy1642:
++YYCURSOR;
yy1643:
YYDEBUG(1643, *YYCURSOR);
#line 1088 "ext/date/lib/parse_date.re"
#line 1093 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -25737,7 +25742,7 @@ yy1643:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 25741 "<stdout>"
#line 25746 "<stdout>"
yy1644:
YYDEBUG(1644, *YYCURSOR);
yyaccept = 1;
@@ -25910,7 +25915,7 @@ yy1649:
goto yy1643;
}
}
#line 1916 "ext/date/lib/parse_date.re"
#line 1921 "ext/date/lib/parse_date.re"
}
+6 -1
View File
@@ -754,7 +754,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;
+3 -3
View File
@@ -30,9 +30,9 @@
# include "timelib_config.h"
#endif
#define TIMELIB_VERSION 202117
#define TIMELIB_EXTENDED_VERSION 20211701
#define TIMELIB_ASCII_VERSION "2021.17"
#define TIMELIB_VERSION 202118
#define TIMELIB_EXTENDED_VERSION 20211801
#define TIMELIB_ASCII_VERSION "2021.18"
#include <stdlib.h>
#include <stdbool.h>
+1 -1
View File
@@ -41,7 +41,7 @@ DateInterval Object
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 1
[invert] => 0
[days] => 0
[special_type] => 0
[special_amount] => 0
+1 -1
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');
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
GH-9165 (strtotime translates a date-time with DST/non-DST hour differently based on default timezone)
Bug 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');
+12
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
+15
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"
}
+22
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
+18
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
@@ -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