diff options
Diffstat (limited to 'ext/date')
| -rw-r--r-- | ext/date/lib/parse_date.c | 100 | ||||
| -rw-r--r-- | ext/date/lib/parse_date.re | 2 | ||||
| -rw-r--r-- | ext/date/lib/parse_iso_intervals.c | 2 | ||||
| -rw-r--r-- | ext/date/php_date.c | 186 | ||||
| -rw-r--r-- | ext/date/php_date.h | 9 | ||||
| -rw-r--r-- | ext/date/tests/bug52062.phpt | 2 | ||||
| -rw-r--r-- | ext/date/tests/bug62561.phpt | 16 | ||||
| -rw-r--r-- | ext/date/tests/bug62896.phpt | 42 | ||||
| -rw-r--r-- | ext/date/tests/date-lenient-create.phpt | 149 | ||||
| -rw-r--r-- | ext/date/tests/date-lenient.phpt | 146 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-1-win32.phpt | 4 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-1.phpt | 4 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-2-win32.phpt | 20 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-2.phpt | 2 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-4.phpt | 11 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_set-1.phpt | 4 |
16 files changed, 515 insertions, 184 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 8583f30a59..5d43efe1e3 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* 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" /* +----------------------------------------------------------------------+ @@ -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..8e1972d99f 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -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..bd1ad05ddd 100644 --- a/ext/date/lib/parse_iso_intervals.c +++ b/ext/date/lib/parse_iso_intervals.c @@ -1,4 +1,4 @@ -/* 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" /* +----------------------------------------------------------------------+ diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e27be7d81e..04f28aac6f 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -495,9 +495,11 @@ int php_date_global_timezone_db_enabled; /* on 90'35; common sunrise declaration (sun body disappeared) */ #define DATE_SUNRISE_ZENITH "90.583333" +static PHP_INI_MH(OnUpdate_date_timezone); + /* {{{ INI Settings */ PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdateString, default_timezone, zend_date_globals, date_globals) + STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdate_date_timezone, default_timezone, zend_date_globals, date_globals) PHP_INI_ENTRY("date.default_latitude", DATE_DEFAULT_LATITUDE, PHP_INI_ALL, NULL) PHP_INI_ENTRY("date.default_longitude", DATE_DEFAULT_LONGITUDE, PHP_INI_ALL, NULL) PHP_INI_ENTRY("date.sunset_zenith", DATE_SUNSET_ZENITH, PHP_INI_ALL, NULL) @@ -563,11 +565,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 = { @@ -597,6 +601,7 @@ static PHP_GINIT_FUNCTION(date) date_globals->default_timezone = NULL; date_globals->timezone = NULL; date_globals->tzcache = NULL; + date_globals->timezone_valid = 0; } /* }}} */ @@ -842,101 +847,58 @@ timelib_tzinfo *php_date_parse_tzfile_wrapper(char *formal_tzname, const timelib } /* }}} */ +/* Callback to check the date.timezone only when changed increases performance */ +/* {{{ static PHP_INI_MH(OnUpdate_date_timezone) */ +static PHP_INI_MH(OnUpdate_date_timezone) +{ + if (OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) { + return FAILURE; + } + + DATEG(timezone_valid) = 0; + if (stage == PHP_INI_STAGE_RUNTIME) { + if (!timelib_timezone_id_is_valid(DATEG(default_timezone), DATE_TIMEZONEDB)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG); + } else { + DATEG(timezone_valid) = 1; + } + } + + return SUCCESS; +} +/* }}} */ + /* {{{ Helper functions */ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) { - char *env; - /* Checking configure timezone */ - if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) { + 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 */ zval ztz; - - if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) && - Z_TYPE(ztz) == IS_STRING && - Z_STRLEN(ztz) > 0 && - timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { + + if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) + && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } - } 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"; + } else if (*DATEG(default_timezone)) { + if (DATEG(timezone_valid) == 1) { + return DATEG(default_timezone); } - - 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; + if (!timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid date.timezone value '%s', we selected the timezone 'UTC' for now.", DATEG(default_timezone)); + return "UTC"; } + + DATEG(timezone_valid) = 1; + return DATEG(default_timezone); } -#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 +982,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 +1009,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 +1024,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 +1179,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 +1311,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 +1921,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 +1972,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 +1993,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 +2001,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; @@ -2097,6 +2063,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; @@ -2108,7 +2081,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; } @@ -2154,7 +2127,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)); @@ -2163,7 +2135,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; @@ -2210,7 +2182,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)); @@ -2219,7 +2190,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; @@ -2244,6 +2215,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; @@ -2255,7 +2234,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; } @@ -2286,7 +2265,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)); @@ -2295,7 +2273,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; @@ -3506,7 +3484,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; @@ -3518,12 +3496,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); } @@ -3545,7 +3524,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); @@ -3568,7 +3547,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; @@ -3578,12 +3557,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); } @@ -3614,7 +3594,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..f0b662b5d9 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -150,10 +150,11 @@ struct _php_period_obj { }; ZEND_BEGIN_MODULE_GLOBALS(date) - char *default_timezone; - char *timezone; - HashTable *tzcache; + char *default_timezone; + char *timezone; + HashTable *tzcache; timelib_error_container *last_errors; + int timezone_valid; ZEND_END_MODULE_GLOBALS(date) #ifdef ZTS @@ -165,7 +166,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_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt new file mode 100644 index 0000000000..6d1982bc13 --- /dev/null +++ b/ext/date/tests/date_default_timezone_get-4.phpt @@ -0,0 +1,11 @@ +--TEST-- +date_default_timezone_get() function [4] +--INI-- +date.timezone=Incorrect/Zone +--FILE-- +<?php + echo date_default_timezone_get(), "\n"; +?> +--EXPECTF-- +Warning: date_default_timezone_get(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d +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 |
