derick Sun Jan 27 22:16:58 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/date/lib parse_date.c parse_date.re
/php-src/ext/date/tests date_create-2.phpt strtotime.phpt
Log:
- MFH: Fixed parsing of timezones
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.29.2.30.2.14.2.3&r2=1.29.2.30.2.14.2.4&diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.3
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.4
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.3 Thu Jan 17
20:44:54 2008
+++ php-src/ext/date/lib/parse_date.c Sun Jan 27 22:16:33 2008
@@ -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"
/*
+----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.c,v 1.29.2.30.2.14.2.3 2008/01/17 20:44:54 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.14.2.4 2008/01/27 22:16:33 derick Exp $ */
#include "timelib.h"
@@ -975,7 +975,7 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
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 @@
++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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
}
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 @@
++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 @@
}
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 @@
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
}
}
-#line 1600 "ext/date/lib/parse_date.re"
+#line 1601 "ext/date/lib/parse_date.re"
}
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.26.2.27.2.12.2.2&r2=1.26.2.27.2.12.2.3&diff_format=u
Index: php-src/ext/date/lib/parse_date.re
diff -u php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.2
php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.3
--- php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.2 Thu Jan 17
20:45:08 2008
+++ php-src/ext/date/lib/parse_date.re Sun Jan 27 22:16:48 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.re,v 1.26.2.27.2.12.2.2 2008/01/17 20:45:08 derick Exp $ */
+/* $Id: parse_date.re,v 1.26.2.27.2.12.2.3 2008/01/27 22:16:48 derick Exp $ */
#include "timelib.h"
@@ -1011,6 +1011,7 @@
TIMELIB_HAVE_RELATIVE();
TIMELIB_UNHAVE_DATE();
TIMELIB_UNHAVE_TIME();
+ TIMELIB_HAVE_TZ();
i = timelib_get_unsigned_nr((char **) &ptr, 24);
s->time->y = 1970;
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_create-2.phpt?r1=1.1.2.1.2.1&r2=1.1.2.1.2.1.2.1&diff_format=u
Index: php-src/ext/date/tests/date_create-2.phpt
diff -u php-src/ext/date/tests/date_create-2.phpt:1.1.2.1.2.1
php-src/ext/date/tests/date_create-2.phpt:1.1.2.1.2.1.2.1
--- php-src/ext/date/tests/date_create-2.phpt:1.1.2.1.2.1 Tue Jul 4
18:13:58 2006
+++ php-src/ext/date/tests/date_create-2.phpt Sun Jan 27 22:16:48 2008
@@ -7,6 +7,10 @@
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
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/strtotime.phpt?r1=1.1.2.2&r2=1.1.2.2.4.1&diff_format=u
Index: php-src/ext/date/tests/strtotime.phpt
diff -u php-src/ext/date/tests/strtotime.phpt:1.1.2.2
php-src/ext/date/tests/strtotime.phpt:1.1.2.2.4.1
--- php-src/ext/date/tests/strtotime.phpt:1.1.2.2 Sun Nov 27 06:51:43 2005
+++ php-src/ext/date/tests/strtotime.phpt Sun Jan 27 22:16:48 2008
@@ -6,6 +6,8 @@
$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";
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php