summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/lib/astro.c2
-rw-r--r--ext/date/lib/dow.c2
-rw-r--r--ext/date/lib/interval.c2
-rw-r--r--ext/date/lib/parse_date.c102
-rw-r--r--ext/date/lib/parse_date.re4
-rw-r--r--ext/date/lib/parse_iso_intervals.c4
-rw-r--r--ext/date/lib/parse_iso_intervals.re2
-rw-r--r--ext/date/lib/parse_tz.c2
-rw-r--r--ext/date/lib/timelib.c2
-rw-r--r--ext/date/lib/timelib.h2
-rw-r--r--ext/date/lib/timelib_structs.h2
-rw-r--r--ext/date/lib/tm2unixtime.c2
-rw-r--r--ext/date/lib/unixtime2tm.c2
-rw-r--r--ext/date/php_date.c144
-rw-r--r--ext/date/php_date.h4
-rw-r--r--ext/date/tests/bug52062.phpt2
-rw-r--r--ext/date/tests/bug62561.phpt16
-rw-r--r--ext/date/tests/bug62896.phpt42
-rw-r--r--ext/date/tests/date-lenient-create.phpt149
-rw-r--r--ext/date/tests/date-lenient.phpt146
-rw-r--r--ext/date/tests/date_default_timezone_get-1-win32.phpt4
-rw-r--r--ext/date/tests/date_default_timezone_get-1.phpt4
-rw-r--r--ext/date/tests/date_default_timezone_get-2-win32.phpt20
-rw-r--r--ext/date/tests/date_default_timezone_get-2.phpt2
-rw-r--r--ext/date/tests/date_default_timezone_set-1.phpt4
25 files changed, 477 insertions, 190 deletions
diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c
index d770d1aaed..064700f912 100644
--- a/ext/date/lib/astro.c
+++ b/ext/date/lib/astro.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c
index b6c2d69682..9cb9c9cd28 100644
--- a/ext/date/lib/dow.c
+++ b/ext/date/lib/dow.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c
index 96867ba2b7..451b463191 100644
--- a/ext/date/lib/interval.c
+++ b/ext/date/lib/interval.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 8583f30a59..4829da6c91 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,10 +1,10 @@
-/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:41 2011 */
+/* Generated by re2c 0.13.5 on Sun Sep 30 20:14:42 2012 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -995,7 +995,7 @@ std:
}
yy2:
YYDEBUG(2, *YYCURSOR);
-#line 1082 "ext/date/lib/parse_date.re"
+#line 1083 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -1034,7 +1034,7 @@ yy3:
}
yy4:
YYDEBUG(4, *YYCURSOR);
-#line 1676 "ext/date/lib/parse_date.re"
+#line 1677 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -1358,7 +1358,7 @@ yy12:
if (yych <= '9') goto yy1385;
yy13:
YYDEBUG(13, *YYCURSOR);
-#line 1771 "ext/date/lib/parse_date.re"
+#line 1772 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
@@ -2420,7 +2420,7 @@ yy49:
if (yych <= '9') goto yy55;
yy50:
YYDEBUG(50, *YYCURSOR);
-#line 1760 "ext/date/lib/parse_date.re"
+#line 1761 "ext/date/lib/parse_date.re"
{
goto std;
}
@@ -2433,7 +2433,7 @@ yy52:
YYDEBUG(52, *YYCURSOR);
++YYCURSOR;
YYDEBUG(53, *YYCURSOR);
-#line 1765 "ext/date/lib/parse_date.re"
+#line 1766 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
@@ -2825,7 +2825,7 @@ yy72:
if (yych == 's') goto yy74;
yy73:
YYDEBUG(73, *YYCURSOR);
-#line 1744 "ext/date/lib/parse_date.re"
+#line 1745 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -3602,7 +3602,7 @@ yy166:
}
yy167:
YYDEBUG(167, *YYCURSOR);
-#line 1607 "ext/date/lib/parse_date.re"
+#line 1608 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -4139,7 +4139,7 @@ yy193:
}
yy194:
YYDEBUG(194, *YYCURSOR);
-#line 1666 "ext/date/lib/parse_date.re"
+#line 1667 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -4199,7 +4199,7 @@ yy198:
}
yy199:
YYDEBUG(199, *YYCURSOR);
-#line 1412 "ext/date/lib/parse_date.re"
+#line 1413 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -4481,7 +4481,7 @@ yy222:
}
yy223:
YYDEBUG(223, *YYCURSOR);
-#line 1714 "ext/date/lib/parse_date.re"
+#line 1715 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -5208,7 +5208,7 @@ yy278:
YYDEBUG(278, *YYCURSOR);
++YYCURSOR;
YYDEBUG(279, *YYCURSOR);
-#line 1690 "ext/date/lib/parse_date.re"
+#line 1691 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -5409,7 +5409,7 @@ yy294:
++YYCURSOR;
yy295:
YYDEBUG(295, *YYCURSOR);
-#line 1384 "ext/date/lib/parse_date.re"
+#line 1385 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -6642,7 +6642,7 @@ yy362:
if (yych <= '9') goto yy365;
yy364:
YYDEBUG(364, *YYCURSOR);
-#line 1528 "ext/date/lib/parse_date.re"
+#line 1529 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -7293,7 +7293,7 @@ yy392:
}
yy393:
YYDEBUG(393, *YYCURSOR);
-#line 1586 "ext/date/lib/parse_date.re"
+#line 1587 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -9063,7 +9063,7 @@ yy454:
++YYCURSOR;
yy455:
YYDEBUG(455, *YYCURSOR);
-#line 1289 "ext/date/lib/parse_date.re"
+#line 1290 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -9634,7 +9634,7 @@ yy475:
}
yy476:
YYDEBUG(476, *YYCURSOR);
-#line 1426 "ext/date/lib/parse_date.re"
+#line 1427 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9786,7 +9786,7 @@ yy488:
YYDEBUG(488, *YYCURSOR);
++YYCURSOR;
YYDEBUG(489, *YYCURSOR);
-#line 1144 "ext/date/lib/parse_date.re"
+#line 1145 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9815,7 +9815,7 @@ yy490:
}
yy491:
YYDEBUG(491, *YYCURSOR);
-#line 1181 "ext/date/lib/parse_date.re"
+#line 1182 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -10150,7 +10150,7 @@ yy523:
YYDEBUG(523, *YYCURSOR);
++YYCURSOR;
YYDEBUG(524, *YYCURSOR);
-#line 1161 "ext/date/lib/parse_date.re"
+#line 1162 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -10275,7 +10275,7 @@ yy534:
if (yych <= '9') goto yy541;
yy535:
YYDEBUG(535, *YYCURSOR);
-#line 1343 "ext/date/lib/parse_date.re"
+#line 1344 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -11026,7 +11026,7 @@ yy605:
YYDEBUG(606, *YYCURSOR);
++YYCURSOR;
YYDEBUG(607, *YYCURSOR);
-#line 1358 "ext/date/lib/parse_date.re"
+#line 1359 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -11073,7 +11073,7 @@ yy611:
if (yych <= '9') goto yy605;
yy612:
YYDEBUG(612, *YYCURSOR);
-#line 1370 "ext/date/lib/parse_date.re"
+#line 1371 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -11727,7 +11727,7 @@ yy656:
}
yy657:
YYDEBUG(657, *YYCURSOR);
-#line 1329 "ext/date/lib/parse_date.re"
+#line 1330 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11846,7 +11846,7 @@ yy666:
}
yy667:
YYDEBUG(667, *YYCURSOR);
-#line 1273 "ext/date/lib/parse_date.re"
+#line 1274 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -12094,7 +12094,7 @@ yy700:
if (yych <= ':') goto yy704;
yy701:
YYDEBUG(701, *YYCURSOR);
-#line 1556 "ext/date/lib/parse_date.re"
+#line 1557 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -12666,7 +12666,7 @@ yy763:
}
yy764:
YYDEBUG(764, *YYCURSOR);
-#line 1301 "ext/date/lib/parse_date.re"
+#line 1302 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -12718,7 +12718,7 @@ yy771:
YYDEBUG(771, *YYCURSOR);
++YYCURSOR;
YYDEBUG(772, *YYCURSOR);
-#line 1542 "ext/date/lib/parse_date.re"
+#line 1543 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -12869,7 +12869,7 @@ yy783:
}
yy784:
YYDEBUG(784, *YYCURSOR);
-#line 1577 "ext/date/lib/parse_date.re"
+#line 1578 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -13028,7 +13028,7 @@ yy793:
}
yy794:
YYDEBUG(794, *YYCURSOR);
-#line 1398 "ext/date/lib/parse_date.re"
+#line 1399 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -13256,7 +13256,7 @@ yy814:
if (yych <= '7') goto yy817;
yy815:
YYDEBUG(815, *YYCURSOR);
-#line 1509 "ext/date/lib/parse_date.re"
+#line 1510 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -13284,7 +13284,7 @@ yy817:
YYDEBUG(817, *YYCURSOR);
++YYCURSOR;
YYDEBUG(818, *YYCURSOR);
-#line 1490 "ext/date/lib/parse_date.re"
+#line 1491 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -13366,7 +13366,7 @@ yy821:
}
yy822:
YYDEBUG(822, *YYCURSOR);
-#line 1476 "ext/date/lib/parse_date.re"
+#line 1477 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -13482,7 +13482,7 @@ yy842:
++YYCURSOR;
yy843:
YYDEBUG(843, *YYCURSOR);
-#line 1450 "ext/date/lib/parse_date.re"
+#line 1451 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -13769,7 +13769,7 @@ yy848:
}
yy849:
YYDEBUG(849, *YYCURSOR);
-#line 1438 "ext/date/lib/parse_date.re"
+#line 1439 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -14700,7 +14700,7 @@ yy973:
if (yych <= '9') goto yy996;
yy974:
YYDEBUG(974, *YYCURSOR);
-#line 1315 "ext/date/lib/parse_date.re"
+#line 1316 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -15722,7 +15722,7 @@ yy1066:
}
yy1068:
YYDEBUG(1068, *YYCURSOR);
-#line 1207 "ext/date/lib/parse_date.re"
+#line 1208 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -15836,7 +15836,7 @@ yy1075:
}
yy1076:
YYDEBUG(1076, *YYCURSOR);
-#line 1253 "ext/date/lib/parse_date.re"
+#line 1254 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -16753,7 +16753,7 @@ yy1117:
}
yy1118:
YYDEBUG(1118, *YYCURSOR);
-#line 1649 "ext/date/lib/parse_date.re"
+#line 1650 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16820,7 +16820,7 @@ yy1126:
YYDEBUG(1126, *YYCURSOR);
++YYCURSOR;
YYDEBUG(1127, *YYCURSOR);
-#line 1122 "ext/date/lib/parse_date.re"
+#line 1123 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -16949,7 +16949,7 @@ yy1141:
}
yy1142:
YYDEBUG(1142, *YYCURSOR);
-#line 1625 "ext/date/lib/parse_date.re"
+#line 1626 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -19649,7 +19649,7 @@ yy1294:
goto yy1298;
yy1295:
YYDEBUG(1295, *YYCURSOR);
-#line 1099 "ext/date/lib/parse_date.re"
+#line 1100 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -21382,11 +21382,12 @@ yy1387:
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
s->time->z = 0;
+ s->time->dst = 0;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21390 "ext/date/lib/parse_date.c"
+#line 21391 "ext/date/lib/parse_date.c"
yy1388:
YYDEBUG(1388, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21833,7 +21834,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21837 "ext/date/lib/parse_date.c"
+#line 21838 "ext/date/lib/parse_date.c"
yy1418:
YYDEBUG(1418, *YYCURSOR);
yych = *++YYCURSOR;
@@ -21877,7 +21878,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 21881 "ext/date/lib/parse_date.c"
+#line 21882 "ext/date/lib/parse_date.c"
yy1421:
YYDEBUG(1421, *YYCURSOR);
yych = *++YYCURSOR;
@@ -23897,7 +23898,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 23901 "ext/date/lib/parse_date.c"
+#line 23902 "ext/date/lib/parse_date.c"
yy1501:
YYDEBUG(1501, *YYCURSOR);
yych = *++YYCURSOR;
@@ -24047,7 +24048,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24051 "ext/date/lib/parse_date.c"
+#line 24052 "ext/date/lib/parse_date.c"
yy1509:
YYDEBUG(1509, *YYCURSOR);
yyaccept = 0;
@@ -24591,7 +24592,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 24595 "ext/date/lib/parse_date.c"
+#line 24596 "ext/date/lib/parse_date.c"
yy1532:
YYDEBUG(1532, *YYCURSOR);
yyaccept = 0;
@@ -24764,7 +24765,7 @@ yy1537:
goto yy1531;
}
}
-#line 1775 "ext/date/lib/parse_date.re"
+#line 1776 "ext/date/lib/parse_date.re"
}
@@ -25070,6 +25071,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
s->time->z = 0;
+ s->time->dst = 0;
break;
case 'e': /* timezone */
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index b130fd0e57..5a8b6134b9 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -1073,6 +1073,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
s->time->z = 0;
+ s->time->dst = 0;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
@@ -2077,6 +2078,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
s->time->is_localtime = 1;
s->time->zone_type = TIMELIB_ZONETYPE_OFFSET;
s->time->z = 0;
+ s->time->dst = 0;
break;
case 'e': /* timezone */
diff --git a/ext/date/lib/parse_iso_intervals.c b/ext/date/lib/parse_iso_intervals.c
index 94dddaa136..d52c24d38f 100644
--- a/ext/date/lib/parse_iso_intervals.c
+++ b/ext/date/lib/parse_iso_intervals.c
@@ -1,10 +1,10 @@
-/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:31 2011 */
+/* Generated by re2c 0.13.5 on Mon Dec 5 22:02:27 2011 */
#line 1 "ext/date/lib/parse_iso_intervals.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/parse_iso_intervals.re b/ext/date/lib/parse_iso_intervals.re
index 56aa34d8e0..e52868865b 100644
--- a/ext/date/lib/parse_iso_intervals.re
+++ b/ext/date/lib/parse_iso_intervals.re
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index d3abf84c81..009a2ad4e6 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c
index 2f457a9882..43eedf780c 100644
--- a/ext/date/lib/timelib.c
+++ b/ext/date/lib/timelib.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
index 478dec32d0..671d37fd9e 100644
--- a/ext/date/lib/timelib.h
+++ b/ext/date/lib/timelib.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h
index a3d7793447..6662d91b1b 100644
--- a/ext/date/lib/timelib_structs.h
+++ b/ext/date/lib/timelib_structs.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c
index e15a38150c..6085bb14da 100644
--- a/ext/date/lib/tm2unixtime.c
+++ b/ext/date/lib/tm2unixtime.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c
index c177feebb1..48709f42fc 100644
--- a/ext/date/lib/unixtime2tm.c
+++ b/ext/date/lib/unixtime2tm.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 2b4b4b50ea..b5882271e3 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -563,11 +563,13 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC);
static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC);
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC);
+static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties(zval *object TSRMLS_DC);
+static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *n TSRMLS_DC);
static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC);
-zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC);
-void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS_DC);
+zval *date_interval_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC);
+void date_interval_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
/* {{{ Module struct */
zend_module_entry date_module_entry = {
@@ -845,17 +847,10 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib
/* {{{ Helper functions */
static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
{
- char *env;
-
/* Checking configure timezone */
if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) {
return DATEG(timezone);
}
- /* Check environment variable */
- env = getenv("TZ");
- if (env && *env && timelib_timezone_id_is_valid(env, tzdb)) {
- return env;
- }
/* Check config setting for default timezone */
if (!DATEG(default_timezone)) {
/* Special case: ext/date wasn't initialized yet */
@@ -870,73 +865,8 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
} else if (*DATEG(default_timezone) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
return DATEG(default_timezone);
}
-#if HAVE_TM_ZONE
- /* Try to guess timezone from system information */
- {
- struct tm *ta, tmbuf;
- time_t the_time;
- char *tzid = NULL;
-
- the_time = time(NULL);
- ta = php_localtime_r(&the_time, &tmbuf);
- if (ta) {
- tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
- }
- if (! tzid) {
- tzid = "UTC";
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%s/%.1f/%s' instead", tzid, ta ? ta->tm_zone : "Unknown", ta ? (float) (ta->tm_gmtoff / 3600) : 0, ta ? (ta->tm_isdst ? "DST" : "no DST") : "Unknown");
- return tzid;
- }
-#endif
-#ifdef PHP_WIN32
- {
- char *tzid;
- TIME_ZONE_INFORMATION tzi;
-
- switch (GetTimeZoneInformation(&tzi))
- {
- /* DST in effect */
- case TIME_ZONE_ID_DAYLIGHT:
- /* If user has disabled DST in the control panel, Windows returns 0 here */
- if (tzi.DaylightBias == 0) {
- goto php_win_std_time;
- }
-
- tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.DaylightBias) * -60, 1);
- if (! tzid) {
- tzid = "UTC";
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, ((tzi.Bias + tzi.DaylightBias) / -60.0));
- break;
-
- /* no DST or not in effect */
- case TIME_ZONE_ID_UNKNOWN:
- case TIME_ZONE_ID_STANDARD:
- default:
-php_win_std_time:
- tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.StandardBias) * -60, 0);
- if (! tzid) {
- tzid = "UTC";
- }
- php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0));
- break;
-
- }
- return tzid;
- }
-#elif defined(NETWARE)
- /* Try to guess timezone from system information */
- {
- char *tzid = timelib_timezone_id_from_abbr("", ((_timezone * -1) + (daylightOffset * daylightOnOff)), daylightOnOff);
- if (tzid) {
- return tzid;
- }
- }
-#endif
/* Fallback to UTC */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.");
return "UTC";
}
@@ -1020,6 +950,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
timelib_time_offset *offset = NULL;
timelib_sll isoweek, isoyear;
int rfc_colon;
+ int weekYearSet = 0;
if (!format_len) {
return estrdup("");
@@ -1046,7 +977,6 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
offset = timelib_get_time_zone_info(t->sse, t->tz_info);
}
}
- timelib_isoweek_from_date(t->y, t->m, t->d, &isoweek, &isoyear);
for (i = 0; i < format_len; i++) {
rfc_colon = 0;
@@ -1062,8 +992,12 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
case 'z': length = slprintf(buffer, 32, "%d", (int) timelib_day_of_year(t->y, t->m, t->d)); break;
/* week */
- case 'W': length = slprintf(buffer, 32, "%02d", (int) isoweek); break; /* iso weeknr */
- case 'o': length = slprintf(buffer, 32, "%d", (int) isoyear); break; /* iso year */
+ case 'W':
+ if(!weekYearSet) { timelib_isoweek_from_date(t->y, t->m, t->d, &isoweek, &isoyear); weekYearSet = 1; }
+ length = slprintf(buffer, 32, "%02d", (int) isoweek); break; /* iso weeknr */
+ case 'o':
+ if(!weekYearSet) { timelib_isoweek_from_date(t->y, t->m, t->d, &isoweek, &isoyear); weekYearSet = 1; }
+ length = slprintf(buffer, 32, "%d", (int) isoyear); break; /* iso year */
/* month */
case 'F': length = slprintf(buffer, 32, "%s", mon_full_names[t->m - 1]); break;
@@ -1213,14 +1147,13 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
/* {{{ php_idate
*/
-PHPAPI int php_idate(char format, time_t ts, int localtime)
+PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
{
timelib_time *t;
timelib_tzinfo *tzi;
int retval = -1;
timelib_time_offset *offset = NULL;
timelib_sll isoweek, isoyear;
- TSRMLS_FETCH();
t = timelib_time_ctor();
@@ -1346,7 +1279,7 @@ PHP_FUNCTION(idate)
ts = time(NULL);
}
- ret = php_idate(format[0], ts, 0);
+ ret = php_idate(format[0], ts, 0 TSRMLS_CC);
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
RETURN_FALSE;
@@ -1956,6 +1889,7 @@ static void date_register_classes(TSRMLS_D)
date_object_handlers_date.clone_obj = date_object_clone_date;
date_object_handlers_date.compare_objects = date_object_compare_date;
date_object_handlers_date.get_properties = date_object_get_properties;
+ date_object_handlers_date.get_gc = date_object_get_gc;
#define REGISTER_DATE_CLASS_CONST_STRING(const_name, value) \
zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
@@ -2006,6 +1940,7 @@ static void date_register_classes(TSRMLS_D)
date_object_handlers_interval.write_property = date_interval_write_property;
date_object_handlers_interval.get_properties = date_object_get_properties_interval;
date_object_handlers_interval.get_property_ptr_ptr = NULL;
+ date_object_handlers_interval.get_gc = date_object_get_gc_interval;
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
ce_period.create_object = date_object_new_period;
@@ -2026,7 +1961,6 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
{
php_date_obj *intern;
zend_object_value retval;
- zval *tmp;
intern = emalloc(sizeof(php_date_obj));
memset(intern, 0, sizeof(php_date_obj));
@@ -2035,7 +1969,7 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
}
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *));
+ object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_date;
@@ -2093,6 +2027,13 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
return 1;
}
+static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
+{
+ *table = NULL;
+ *n = 0;
+ return zend_std_get_properties(object TSRMLS_CC);
+}
+
static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
{
HashTable *props;
@@ -2104,7 +2045,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
props = zend_std_get_properties(object TSRMLS_CC);
- if (!dateobj->time || GC_G(gc_active)) {
+ if (!dateobj->time) {
return props;
}
@@ -2150,7 +2091,6 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
{
php_timezone_obj *intern;
zend_object_value retval;
- zval *tmp;
intern = emalloc(sizeof(php_timezone_obj));
memset(intern, 0, sizeof(php_timezone_obj));
@@ -2159,7 +2099,7 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
}
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *));
+ object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_timezone;
@@ -2206,7 +2146,6 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
{
php_interval_obj *intern;
zend_object_value retval;
- zval *tmp;
intern = emalloc(sizeof(php_interval_obj));
memset(intern, 0, sizeof(php_interval_obj));
@@ -2215,7 +2154,7 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
}
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *));
+ object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_interval;
@@ -2240,6 +2179,14 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
return new_ov;
}
+static HashTable *date_object_get_gc_interval(zval *object, zval ***table, int *n TSRMLS_DC)
+{
+
+ *table = NULL;
+ *n = 0;
+ return zend_std_get_properties(object TSRMLS_CC);
+}
+
static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
{
HashTable *props;
@@ -2251,7 +2198,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
props = zend_std_get_properties(object TSRMLS_CC);
- if (!intervalobj->initialized || GC_G(gc_active)) {
+ if (!intervalobj->initialized) {
return props;
}
@@ -2282,7 +2229,6 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
{
php_period_obj *intern;
zend_object_value retval;
- zval *tmp;
intern = emalloc(sizeof(php_period_obj));
memset(intern, 0, sizeof(php_period_obj));
@@ -2291,7 +2237,7 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
}
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor, (void *) &tmp, sizeof(zval *));
+ object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
retval.handlers = &date_object_handlers_period;
@@ -3495,7 +3441,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
}
/* {{{ date_interval_read_property */
-zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC)
+zval *date_interval_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC)
{
php_interval_obj *obj;
zval *retval;
@@ -3507,12 +3453,13 @@ zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC
zval_copy_ctor(&tmp_member);
convert_to_string(&tmp_member);
member = &tmp_member;
+ key = NULL;
}
obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC);
if (!obj->initialized) {
- retval = (zend_get_std_object_handlers())->read_property(object, member, type TSRMLS_CC);
+ retval = (zend_get_std_object_handlers())->read_property(object, member, type, key TSRMLS_CC);
if (member == &tmp_member) {
zval_dtor(member);
}
@@ -3534,7 +3481,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC
GET_VALUE_FROM_STRUCT(invert, "invert");
GET_VALUE_FROM_STRUCT(days, "days");
/* didn't find any */
- retval = (zend_get_std_object_handlers())->read_property(object, member, type TSRMLS_CC);
+ retval = (zend_get_std_object_handlers())->read_property(object, member, type, key TSRMLS_CC);
if (member == &tmp_member) {
zval_dtor(member);
@@ -3557,7 +3504,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type TSRMLS_DC
/* }}} */
/* {{{ date_interval_write_property */
-void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
+void date_interval_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC)
{
php_interval_obj *obj;
zval tmp_member, tmp_value;
@@ -3567,12 +3514,13 @@ void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS
zval_copy_ctor(&tmp_member);
convert_to_string(&tmp_member);
member = &tmp_member;
+ key = NULL;
}
obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC);
if (!obj->initialized) {
- (zend_get_std_object_handlers())->write_property(object, member, value TSRMLS_CC);
+ (zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC);
if (member == &tmp_member) {
zval_dtor(member);
}
@@ -3603,7 +3551,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value TSRMLS
SET_VALUE_FROM_STRUCT(s, "s");
SET_VALUE_FROM_STRUCT(invert, "invert");
/* didn't find any */
- (zend_get_std_object_handlers())->write_property(object, member, value TSRMLS_CC);
+ (zend_get_std_object_handlers())->write_property(object, member, value, key TSRMLS_CC);
} while(0);
if (member == &tmp_member) {
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index a86d6c7e70..b2f4e9fd27 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2013 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -165,7 +165,7 @@ ZEND_END_MODULE_GLOBALS(date)
/* Backwards compability wrapper */
PHPAPI signed long php_parse_date(char *string, signed long *now);
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
-PHPAPI int php_idate(char format, time_t ts, int localtime);
+PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
#if HAVE_STRFTIME
#define _php_strftime php_strftime
PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt
index 81e767b0f0..1d814377c6 100644
--- a/ext/date/tests/bug52062.phpt
+++ b/ext/date/tests/bug52062.phpt
@@ -4,6 +4,8 @@ Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimest
<?php
if (PHP_INT_SIZE == 8) die('skip 32-bit only');
?>
+--XFAIL--
+Waiting for resolution of the 32-bit case.
--INI--
date.timezone=UTC
--FILE--
diff --git a/ext/date/tests/bug62561.phpt b/ext/date/tests/bug62561.phpt
new file mode 100644
index 0000000000..0ed32c15a1
--- /dev/null
+++ b/ext/date/tests/bug62561.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #62561 Unixtimestamp may take on local times DST flag (this test will only be valid during EDT)
+--FILE--
+<?php
+$tz = new DateTimeZone('America/New_York');
+$ts = new DateTime('@1341115200', $tz);
+$int = new DateInterval('P1D');
+$dayFromTs = new DateTime('@1341115200', new DateTimeZone('America/New_York'));
+$dayFromTs->add($int);
+
+echo 'ts: '.$ts->format('Y-m-d H:i:s')."\n";
+echo 'day from ts: '.$dayFromTs->format('Y-m-d H:i:s')."\n";
+?>
+--EXPECT--
+ts: 2012-07-01 04:00:00
+day from ts: 2012-07-02 04:00:00
diff --git a/ext/date/tests/bug62896.phpt b/ext/date/tests/bug62896.phpt
new file mode 100644
index 0000000000..ccdcfb029c
--- /dev/null
+++ b/ext/date/tests/bug62896.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #62896 Unixtimestamp may take on local times DST flag (this test will only be valid during CEST)
+--INI--
+date.timezone=Europe/Berlin
+--FILE--
+<?php
+ $tz = new DateTimeZone('Europe/Berlin');
+
+ echo "FROM TIMESTAMP, NO TZ:\n";
+
+ $date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST'));
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ $date->modify('+0 days');
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ echo "FROM TIMESTAMP, WITH TZ:\n";
+
+ $date = new DateTime('@'.strtotime('2012-08-22 00:00:00 CEST'));
+ $date->setTimezone($tz);
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ $date->modify('+0 days');
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ echo "FROM STRING:\n";
+
+ $date = new DateTime('2012-08-22 00:00:00 CEST', $tz);
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+
+ $date->modify('+0 days');
+ echo $date->format('Y-m-d H:i:s T').' (offset '.$date->getOffset().")\n";
+--EXPECT--
+FROM TIMESTAMP, NO TZ:
+2012-08-21 22:00:00 GMT+0000 (offset 0)
+2012-08-21 22:00:00 GMT+0000 (offset 0)
+FROM TIMESTAMP, WITH TZ:
+2012-08-22 00:00:00 CEST (offset 7200)
+2012-08-22 00:00:00 CEST (offset 7200)
+FROM STRING:
+2012-08-22 00:00:00 CEST (offset 7200)
+2012-08-22 00:00:00 CEST (offset 7200)
diff --git a/ext/date/tests/date-lenient-create.phpt b/ext/date/tests/date-lenient-create.phpt
new file mode 100644
index 0000000000..49ee3c1371
--- /dev/null
+++ b/ext/date/tests/date-lenient-create.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Test for + character in date format
+--FILE--
+<?php
+$tz = new DateTimeZone("UTC");
+$date = "06/08/04 12:00";
+echo "==\n";
+print_r( date_create_from_format( 'm/d/y', $date , $tz) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( 'm/d/y+', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( '+m/d/y', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( 'm/d/y++', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+
+$date = "06/08/04";
+print_r( date_create_from_format( 'm/d/y+', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+print_r( date_create_from_format( '+m/d/y', $date , $tz)->setTime(0, 0) );
+print_r( date_get_last_errors() );
+echo "==\n";
+
+?>
+--EXPECT--
+==
+Array
+(
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 1
+ [errors] => Array
+ (
+ [8] => Trailing data
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
+DateTime Object
+(
+ [date] => 2004-06-08 00:00:00
+ [timezone_type] => 3
+ [timezone] => UTC
+)
+Array
+(
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+)
+==
diff --git a/ext/date/tests/date-lenient.phpt b/ext/date/tests/date-lenient.phpt
new file mode 100644
index 0000000000..e5862e191e
--- /dev/null
+++ b/ext/date/tests/date-lenient.phpt
@@ -0,0 +1,146 @@
+--TEST--
+Test for + character in date format
+--FILE--
+<?php
+$date = "06/08/04 12:00";
+print_r( date_parse_from_format( 'm/d/y', $date ) );
+print_r( date_parse_from_format( 'm/d/y+', $date ) );
+print_r( date_parse_from_format( '+m/d/y', $date ) );
+print_r( date_parse_from_format( 'm/d/y++', $date ) );
+
+$date = "06/08/04";
+print_r( date_parse_from_format( 'm/d/y+', $date ) );
+print_r( date_parse_from_format( '+m/d/y', $date ) );
+
+?>
+--EXPECT--
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 1
+ [errors] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 1
+ [warnings] => Array
+ (
+ [8] => Trailing data
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
+Array
+(
+ [year] => 2004
+ [month] => 6
+ [day] => 8
+ [hour] =>
+ [minute] =>
+ [second] =>
+ [fraction] =>
+ [warning_count] => 0
+ [warnings] => Array
+ (
+ )
+
+ [error_count] => 0
+ [errors] => Array
+ (
+ )
+
+ [is_localtime] =>
+)
diff --git a/ext/date/tests/date_default_timezone_get-1-win32.phpt b/ext/date/tests/date_default_timezone_get-1-win32.phpt
index a12418f701..ed9ac1a478 100644
--- a/ext/date/tests/date_default_timezone_get-1-win32.phpt
+++ b/ext/date/tests/date_default_timezone_get-1-win32.phpt
@@ -17,8 +17,8 @@ date.timezone=
parametrized so there is no hardcoded timezone data.*/
?>
--EXPECTF--
-Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-1-win32.php on line 3
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone '%s' for now, but please set date.timezone to select your timezone. in %s on line %d
%s
-Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-1-win32.php on line 4
+Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone '%s' for now, but please set date.timezone to select your timezone. in %s on line %d
%s
diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt
index 5d17a25caf..4bff31a783 100644
--- a/ext/date/tests/date_default_timezone_get-1.phpt
+++ b/ext/date/tests/date_default_timezone_get-1.phpt
@@ -13,8 +13,8 @@ date.timezone=
echo date('e'), "\n";
?>
--EXPECTF--
-Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 3
UTC
-Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4
+Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 4
UTC
diff --git a/ext/date/tests/date_default_timezone_get-2-win32.phpt b/ext/date/tests/date_default_timezone_get-2-win32.phpt
deleted file mode 100644
index 34da0228b9..0000000000
--- a/ext/date/tests/date_default_timezone_get-2-win32.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-date_default_timezone_get() function [2]
---SKIPIF--
-<?php
- if(substr(PHP_OS, 0, 3) != 'WIN') die("skip on non windows");
-?>
---INI--
-date.timezone=
---FILE--
-<?php
- putenv('TZ=');
- echo date_default_timezone_get(), "\n";
- /* The behaviour on windows is to select an arbitrary timezone name from the current system settings.
- This gives no chance to hardcode the timezone name, for instance for UTC+1 it could choose
- from the multiple names like Europe/Berlin or Europe/Paris . For this reason the test is
- parametrized so there is no hardcoded timezone data.*/
-?>
---EXPECTF--
-Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-2-win32.php on line 3
-%s
diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt
index a72634ee75..f58938d35b 100644
--- a/ext/date/tests/date_default_timezone_get-2.phpt
+++ b/ext/date/tests/date_default_timezone_get-2.phpt
@@ -12,5 +12,5 @@ date.timezone=
echo date_default_timezone_get(), "\n";
?>
--EXPECTF--
-Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-2.php on line 3
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-2.php on line 3
UTC
diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt
index bca8789e78..7afa2b1a16 100644
--- a/ext/date/tests/date_default_timezone_set-1.phpt
+++ b/ext/date/tests/date_default_timezone_set-1.phpt
@@ -22,9 +22,9 @@ date.timezone=
echo date(DATE_ISO8601, $date4), "\n";
?>
--EXPECTF--
-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3
+Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 3
-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4
+Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 4
America/Indiana/Knox
2005-01-12T03:00:00-0500
2005-07-12T03:00:00-0500