mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
- MFH: Fixed parsing of timezones
This commit is contained in:
parent
bb9fa509fe
commit
4b7f5f9630
@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.12.1 on Thu Jan 17 21:36:33 2008 */
|
||||
/* Generated by re2c 0.12.1 on Sun Jan 27 23:04:23 2008 */
|
||||
#line 1 "ext/date/lib/parse_date.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@ -975,7 +975,7 @@ yy2:
|
||||
}
|
||||
yy3:
|
||||
YYDEBUG(3, *YYCURSOR);
|
||||
#line 1501 "ext/date/lib/parse_date.re"
|
||||
#line 1502 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
@ -1299,7 +1299,7 @@ yy11:
|
||||
if(yych <= '9') goto yy1274;
|
||||
yy12:
|
||||
YYDEBUG(12, *YYCURSOR);
|
||||
#line 1596 "ext/date/lib/parse_date.re"
|
||||
#line 1597 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
add_error(s, "Unexpected character");
|
||||
goto std;
|
||||
@ -2310,7 +2310,7 @@ yy45:
|
||||
if(yych <= '9') goto yy51;
|
||||
yy46:
|
||||
YYDEBUG(46, *YYCURSOR);
|
||||
#line 1585 "ext/date/lib/parse_date.re"
|
||||
#line 1586 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
@ -2323,7 +2323,7 @@ yy48:
|
||||
YYDEBUG(48, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(49, *YYCURSOR);
|
||||
#line 1590 "ext/date/lib/parse_date.re"
|
||||
#line 1591 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
@ -2707,7 +2707,7 @@ yy68:
|
||||
if(yych == 's') goto yy70;
|
||||
yy69:
|
||||
YYDEBUG(69, *YYCURSOR);
|
||||
#line 1569 "ext/date/lib/parse_date.re"
|
||||
#line 1570 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_ull i;
|
||||
DEBUG_OUTPUT("relative");
|
||||
@ -3630,7 +3630,7 @@ yy173:
|
||||
if(yych == 's') goto yy175;
|
||||
yy174:
|
||||
YYDEBUG(174, *YYCURSOR);
|
||||
#line 1474 "ext/date/lib/parse_date.re"
|
||||
#line 1475 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll i;
|
||||
int behavior = 0;
|
||||
@ -4821,7 +4821,7 @@ yy275:
|
||||
}
|
||||
yy276:
|
||||
YYDEBUG(276, *YYCURSOR);
|
||||
#line 1458 "ext/date/lib/parse_date.re"
|
||||
#line 1459 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
const timelib_relunit* relunit;
|
||||
DEBUG_OUTPUT("daytext");
|
||||
@ -5313,7 +5313,7 @@ yy302:
|
||||
}
|
||||
yy303:
|
||||
YYDEBUG(303, *YYCURSOR);
|
||||
#line 1491 "ext/date/lib/parse_date.re"
|
||||
#line 1492 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("monthtext");
|
||||
TIMELIB_INIT;
|
||||
@ -5373,7 +5373,7 @@ yy307:
|
||||
}
|
||||
yy308:
|
||||
YYDEBUG(308, *YYCURSOR);
|
||||
#line 1270 "ext/date/lib/parse_date.re"
|
||||
#line 1271 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datetextual | datenoyear");
|
||||
TIMELIB_INIT;
|
||||
@ -5658,7 +5658,7 @@ yy331:
|
||||
}
|
||||
yy332:
|
||||
YYDEBUG(332, *YYCURSOR);
|
||||
#line 1539 "ext/date/lib/parse_date.re"
|
||||
#line 1540 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
|
||||
@ -6298,7 +6298,7 @@ yy385:
|
||||
YYDEBUG(385, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(386, *YYCURSOR);
|
||||
#line 1515 "ext/date/lib/parse_date.re"
|
||||
#line 1516 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
@ -6497,7 +6497,7 @@ yy401:
|
||||
if(yych <= '9') goto yy397;
|
||||
yy402:
|
||||
YYDEBUG(402, *YYCURSOR);
|
||||
#line 1244 "ext/date/lib/parse_date.re"
|
||||
#line 1245 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoday");
|
||||
TIMELIB_INIT;
|
||||
@ -7745,7 +7745,7 @@ yy471:
|
||||
if(yych <= '9') goto yy474;
|
||||
yy473:
|
||||
YYDEBUG(473, *YYCURSOR);
|
||||
#line 1384 "ext/date/lib/parse_date.re"
|
||||
#line 1385 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pgtextshort");
|
||||
TIMELIB_INIT;
|
||||
@ -9638,7 +9638,7 @@ yy557:
|
||||
}
|
||||
yy558:
|
||||
YYDEBUG(558, *YYCURSOR);
|
||||
#line 1440 "ext/date/lib/parse_date.re"
|
||||
#line 1441 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("ago");
|
||||
TIMELIB_INIT;
|
||||
@ -12250,7 +12250,7 @@ yy659:
|
||||
++YYCURSOR;
|
||||
yy660:
|
||||
YYDEBUG(660, *YYCURSOR);
|
||||
#line 1155 "ext/date/lib/parse_date.re"
|
||||
#line 1156 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
|
||||
TIMELIB_INIT;
|
||||
@ -12821,7 +12821,7 @@ yy680:
|
||||
}
|
||||
yy681:
|
||||
YYDEBUG(681, *YYCURSOR);
|
||||
#line 1283 "ext/date/lib/parse_date.re"
|
||||
#line 1284 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenoyearrev");
|
||||
TIMELIB_INIT;
|
||||
@ -12973,7 +12973,7 @@ yy693:
|
||||
YYDEBUG(693, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(694, *YYCURSOR);
|
||||
#line 1031 "ext/date/lib/parse_date.re"
|
||||
#line 1032 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
|
||||
TIMELIB_INIT;
|
||||
@ -13002,7 +13002,7 @@ yy695:
|
||||
}
|
||||
yy696:
|
||||
YYDEBUG(696, *YYCURSOR);
|
||||
#line 1048 "ext/date/lib/parse_date.re"
|
||||
#line 1049 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
|
||||
@ -13295,7 +13295,7 @@ yy723:
|
||||
if(yych <= '9') goto yy730;
|
||||
yy724:
|
||||
YYDEBUG(724, *YYCURSOR);
|
||||
#line 1205 "ext/date/lib/parse_date.re"
|
||||
#line 1206 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datefull");
|
||||
TIMELIB_INIT;
|
||||
@ -14064,7 +14064,7 @@ yy795:
|
||||
if(yych <= '9') goto yy797;
|
||||
yy796:
|
||||
YYDEBUG(796, *YYCURSOR);
|
||||
#line 1231 "ext/date/lib/parse_date.re"
|
||||
#line 1232 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YY");
|
||||
TIMELIB_INIT;
|
||||
@ -14085,7 +14085,7 @@ yy797:
|
||||
YYDEBUG(798, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(799, *YYCURSOR);
|
||||
#line 1219 "ext/date/lib/parse_date.re"
|
||||
#line 1220 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pointed date YYYY");
|
||||
TIMELIB_INIT;
|
||||
@ -14714,7 +14714,7 @@ yy843:
|
||||
}
|
||||
yy844:
|
||||
YYDEBUG(844, *YYCURSOR);
|
||||
#line 1192 "ext/date/lib/parse_date.re"
|
||||
#line 1193 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnudateshort");
|
||||
TIMELIB_INIT;
|
||||
@ -14832,7 +14832,7 @@ yy853:
|
||||
}
|
||||
yy854:
|
||||
YYDEBUG(854, *YYCURSOR);
|
||||
#line 1140 "ext/date/lib/parse_date.re"
|
||||
#line 1141 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("americanshort | american");
|
||||
TIMELIB_INIT;
|
||||
@ -15069,7 +15069,7 @@ yy886:
|
||||
if(yych <= ':') goto yy890;
|
||||
yy887:
|
||||
YYDEBUG(887, *YYCURSOR);
|
||||
#line 1410 "ext/date/lib/parse_date.re"
|
||||
#line 1411 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("clf");
|
||||
@ -15584,7 +15584,7 @@ yy941:
|
||||
}
|
||||
yy942:
|
||||
YYDEBUG(942, *YYCURSOR);
|
||||
#line 1167 "ext/date/lib/parse_date.re"
|
||||
#line 1168 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("iso8601date2");
|
||||
TIMELIB_INIT;
|
||||
@ -15635,7 +15635,7 @@ yy949:
|
||||
YYDEBUG(949, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(950, *YYCURSOR);
|
||||
#line 1397 "ext/date/lib/parse_date.re"
|
||||
#line 1398 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pgtextreverse");
|
||||
TIMELIB_INIT;
|
||||
@ -15785,7 +15785,7 @@ yy961:
|
||||
}
|
||||
yy962:
|
||||
YYDEBUG(962, *YYCURSOR);
|
||||
#line 1431 "ext/date/lib/parse_date.re"
|
||||
#line 1432 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("year4");
|
||||
TIMELIB_INIT;
|
||||
@ -15944,7 +15944,7 @@ yy971:
|
||||
}
|
||||
yy972:
|
||||
YYDEBUG(972, *YYCURSOR);
|
||||
#line 1257 "ext/date/lib/parse_date.re"
|
||||
#line 1258 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenodayrev");
|
||||
TIMELIB_INIT;
|
||||
@ -16171,7 +16171,7 @@ yy992:
|
||||
if(yych <= '7') goto yy995;
|
||||
yy993:
|
||||
YYDEBUG(993, *YYCURSOR);
|
||||
#line 1365 "ext/date/lib/parse_date.re"
|
||||
#line 1366 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweek");
|
||||
@ -16199,7 +16199,7 @@ yy995:
|
||||
YYDEBUG(995, *YYCURSOR);
|
||||
++YYCURSOR;
|
||||
YYDEBUG(996, *YYCURSOR);
|
||||
#line 1346 "ext/date/lib/parse_date.re"
|
||||
#line 1347 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
timelib_sll w, d;
|
||||
DEBUG_OUTPUT("isoweekday");
|
||||
@ -16281,7 +16281,7 @@ yy999:
|
||||
}
|
||||
yy1000:
|
||||
YYDEBUG(1000, *YYCURSOR);
|
||||
#line 1333 "ext/date/lib/parse_date.re"
|
||||
#line 1334 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("pgydotd");
|
||||
TIMELIB_INIT;
|
||||
@ -16396,7 +16396,7 @@ yy1020:
|
||||
++YYCURSOR;
|
||||
yy1021:
|
||||
YYDEBUG(1021, *YYCURSOR);
|
||||
#line 1307 "ext/date/lib/parse_date.re"
|
||||
#line 1308 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
|
||||
@ -16683,7 +16683,7 @@ yy1026:
|
||||
}
|
||||
yy1027:
|
||||
YYDEBUG(1027, *YYCURSOR);
|
||||
#line 1295 "ext/date/lib/parse_date.re"
|
||||
#line 1296 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("datenocolon");
|
||||
TIMELIB_INIT;
|
||||
@ -17614,7 +17614,7 @@ yy1151:
|
||||
if(yych <= '9') goto yy1174;
|
||||
yy1152:
|
||||
YYDEBUG(1152, *YYCURSOR);
|
||||
#line 1180 "ext/date/lib/parse_date.re"
|
||||
#line 1181 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnudateshorter");
|
||||
TIMELIB_INIT;
|
||||
@ -18616,7 +18616,7 @@ yy1241:
|
||||
}
|
||||
yy1243:
|
||||
YYDEBUG(1243, *YYCURSOR);
|
||||
#line 1074 "ext/date/lib/parse_date.re"
|
||||
#line 1075 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
DEBUG_OUTPUT("gnunocolon");
|
||||
TIMELIB_INIT;
|
||||
@ -18730,7 +18730,7 @@ yy1250:
|
||||
}
|
||||
yy1251:
|
||||
YYDEBUG(1251, *YYCURSOR);
|
||||
#line 1120 "ext/date/lib/parse_date.re"
|
||||
#line 1121 "ext/date/lib/parse_date.re"
|
||||
{
|
||||
int tz_not_found;
|
||||
DEBUG_OUTPUT("iso8601nocolon");
|
||||
@ -19377,6 +19377,7 @@ yy1276:
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
TIMELIB_UNHAVE_DATE();
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
TIMELIB_HAVE_TZ();
|
||||
|
||||
i = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
s->time->y = 1970;
|
||||
@ -19392,7 +19393,7 @@ yy1276:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 19396 "ext/date/lib/parse_date.c"
|
||||
#line 19397 "ext/date/lib/parse_date.c"
|
||||
yy1277:
|
||||
YYDEBUG(1277, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -19839,7 +19840,7 @@ yy1306:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 19843 "ext/date/lib/parse_date.c"
|
||||
#line 19844 "ext/date/lib/parse_date.c"
|
||||
yy1307:
|
||||
YYDEBUG(1307, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -19883,7 +19884,7 @@ yy1309:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 19887 "ext/date/lib/parse_date.c"
|
||||
#line 19888 "ext/date/lib/parse_date.c"
|
||||
yy1310:
|
||||
YYDEBUG(1310, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -21664,7 +21665,7 @@ yy1387:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21668 "ext/date/lib/parse_date.c"
|
||||
#line 21669 "ext/date/lib/parse_date.c"
|
||||
yy1388:
|
||||
YYDEBUG(1388, *YYCURSOR);
|
||||
yych = *++YYCURSOR;
|
||||
@ -21814,7 +21815,7 @@ yy1395:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 21818 "ext/date/lib/parse_date.c"
|
||||
#line 21819 "ext/date/lib/parse_date.c"
|
||||
yy1396:
|
||||
YYDEBUG(1396, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@ -22305,7 +22306,7 @@ yy1418:
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
#line 22309 "ext/date/lib/parse_date.c"
|
||||
#line 22310 "ext/date/lib/parse_date.c"
|
||||
yy1419:
|
||||
YYDEBUG(1419, *YYCURSOR);
|
||||
yyaccept = 0;
|
||||
@ -22452,7 +22453,7 @@ yy1424:
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 1600 "ext/date/lib/parse_date.re"
|
||||
#line 1601 "ext/date/lib/parse_date.re"
|
||||
|
||||
}
|
||||
|
||||
|
@ -1011,6 +1011,7 @@ relativetext = reltextnumber space reltextunit;
|
||||
TIMELIB_HAVE_RELATIVE();
|
||||
TIMELIB_UNHAVE_DATE();
|
||||
TIMELIB_UNHAVE_TIME();
|
||||
TIMELIB_HAVE_TZ();
|
||||
|
||||
i = timelib_get_unsigned_nr((char **) &ptr, 24);
|
||||
s->time->y = 1970;
|
||||
|
@ -7,6 +7,10 @@ date_create() function [2]
|
||||
date_default_timezone_set("GMT");
|
||||
$d = date_create("2005-07-18 22:10:00 +0400");
|
||||
echo $d->format('D, d M Y H:i:s T'), "\n";
|
||||
|
||||
$d = date_create("@1121710200 +0912");
|
||||
echo $d->format('D, d M Y H:i:s T'), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Mon, 18 Jul 2005 22:10:00 GMT+0400
|
||||
Mon, 18 Jul 2005 18:10:00 GMT+0000
|
||||
|
@ -6,6 +6,8 @@ date_default_timezone_set('Europe/Oslo');
|
||||
$d = array();
|
||||
$d[] = strtotime("2005-07-14 22:30:41");
|
||||
$d[] = strtotime("2005-07-14 22:30:41 GMT");
|
||||
$d[] = strtotime("@1121373041");
|
||||
$d[] = strtotime("@1121373041 CEST");
|
||||
|
||||
foreach($d as $date) {
|
||||
echo date(DATE_ISO8601, $date), "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user