diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-01-11 15:43:42 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-01-11 15:43:42 +0100 |
| commit | 8f1428d29ef91d74b4d272af171675f2971eb15b (patch) | |
| tree | a1f4f4d7dc5bfe8096806dd5c5266634e19fa07a /ext/date/tests | |
| parent | c6e4182351e0173fe58de141e143aac2eacf5efe (diff) | |
| download | php-upstream/5.3.9.tar.gz | |
Imported Upstream version 5.3.9upstream/5.3.9
Diffstat (limited to 'ext/date/tests')
49 files changed, 1830 insertions, 170 deletions
diff --git a/ext/date/tests/DateInterval_format_a.phpt b/ext/date/tests/DateInterval_format_a.phpt index d095db56b..48c6cc167 100644 --- a/ext/date/tests/DateInterval_format_a.phpt +++ b/ext/date/tests/DateInterval_format_a.phpt @@ -8,10 +8,7 @@ date.timezone=UTC --SKIPIF-- <?php if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist"); -if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); ?> ---XFAIL-- -Windows VC6 libs' floor()/ceil() choke on floats --FILE-- <?php diff --git a/ext/date/tests/DateTime_add-fall-type2-type2.phpt b/ext/date/tests/DateTime_add-fall-type2-type2.phpt index 82cc81c9e..894ff604e 100644 --- a/ext/date/tests/DateTime_add-fall-type2-type2.phpt +++ b/ext/date/tests/DateTime_add-fall-type2-type2.phpt @@ -2,8 +2,6 @@ DateTime::add() -- fall type2 type2 --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Various bugs exist --FILE-- <?php @@ -16,38 +14,38 @@ require 'DateTime_data-fall-type2-type2.inc'; test_time_fall_type2_prev_type2_prev: ADD: 2010-10-04 02:18:48 EDT + P+0Y1M2DT16H19M40S = **2010-11-06 18:38:28 EDT** test_time_fall_type2_prev_type2_dt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT** test_time_fall_type2_prev_type2_redodt: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT** -test_time_fall_type2_prev_type2_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST** -test_time_fall_type2_prev_type2_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST** -test_time_fall_type2_prev_type2_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST** +test_time_fall_type2_prev_type2_redost: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT7H36M16S = **2010-11-07 02:14:44 EDT** +test_time_fall_type2_prev_type2_st: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M0DT9H38M27S = **2010-11-07 04:16:55 EDT** +test_time_fall_type2_prev_type2_post: ADD: 2010-11-06 18:38:28 EDT + P+0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EDT** test_time_fall_type2_dt_type2_prev: ADD: 2010-11-07 00:10:20 EDT + P-0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT** test_time_fall_type2_dt_type2_dt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT0H5M15S = **2010-11-07 00:15:35 EDT** test_time_fall_type2_dt_type2_redodt: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT** -test_time_fall_type2_dt_type2_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST** -test_time_fall_type2_dt_type2_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST** -test_time_fall_type2_dt_type2_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST** +test_time_fall_type2_dt_type2_redost: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT2H4M24S = **2010-11-07 02:14:44 EDT** +test_time_fall_type2_dt_type2_st: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M0DT4H6M35S = **2010-11-07 04:16:55 EDT** +test_time_fall_type2_dt_type2_post: ADD: 2010-11-07 00:10:20 EDT + P+0Y0M1DT20H49M39S = **2010-11-08 20:59:59 EDT** test_time_fall_type2_redodt_type2_prev: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT** test_time_fall_type2_redodt_type2_dt: ADD: 2010-11-07 01:12:33 EDT + P-0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT** test_time_fall_type2_redodt_type2_redodt: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT0H3M2S = **2010-11-07 01:15:35 EDT** -test_time_fall_type2_redodt_type2_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST** -test_time_fall_type2_redodt_type2_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST** -test_time_fall_type2_redodt_type2_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST** -test_time_fall_type2_redost_type2_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT** -test_time_fall_type2_redost_type2_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT** -test_time_fall_type2_redost_type2_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT** +test_time_fall_type2_redodt_type2_redost: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT1H2M11S = **2010-11-07 02:14:44 EDT** +test_time_fall_type2_redodt_type2_st: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M0DT3H4M22S = **2010-11-07 04:16:55 EDT** +test_time_fall_type2_redodt_type2_post: ADD: 2010-11-07 01:12:33 EDT + P+0Y0M1DT19H47M26S = **2010-11-08 20:59:59 EDT** +test_time_fall_type2_redost_type2_prev: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT7H36M16S = **2010-11-06 17:38:28 EST** +test_time_fall_type2_redost_type2_dt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT2H4M24S = **2010-11-06 23:10:20 EST** +test_time_fall_type2_redost_type2_redodt: ADD: 2010-11-07 01:14:44 EST + P-0Y0M0DT1H2M11S = **2010-11-07 00:12:33 EST** test_time_fall_type2_redost_type2_redost: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT0H2M10S = **2010-11-07 01:16:54 EST** test_time_fall_type2_redost_type2_st: ADD: 2010-11-07 01:14:44 EST + P+0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST** test_time_fall_type2_redost_type2_post: ADD: 2010-11-07 01:14:44 EST + P+0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST** -test_time_fall_type2_st_type2_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT** -test_time_fall_type2_st_type2_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT** -test_time_fall_type2_st_type2_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT** +test_time_fall_type2_st_type2_prev: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT9H38M27S = **2010-11-06 17:38:28 EST** +test_time_fall_type2_st_type2_dt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT4H6M35S = **2010-11-06 23:10:20 EST** +test_time_fall_type2_st_type2_redodt: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT3H4M22S = **2010-11-07 00:12:33 EST** test_time_fall_type2_st_type2_redost: ADD: 2010-11-07 03:16:55 EST + P-0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST** test_time_fall_type2_st_type2_st: ADD: 2010-11-07 03:16:55 EST + P+0Y0M0DT2H3M1S = **2010-11-07 05:19:56 EST** test_time_fall_type2_st_type2_post: ADD: 2010-11-07 03:16:55 EST + P+0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST** -test_time_fall_type2_post_type2_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT** -test_time_fall_type2_post_type2_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT** -test_time_fall_type2_post_type2_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT** +test_time_fall_type2_post_type2_prev: ADD: 2010-11-08 19:59:59 EST + P-0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EST** +test_time_fall_type2_post_type2_dt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT20H49M39S = **2010-11-06 23:10:20 EST** +test_time_fall_type2_post_type2_redodt: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT19H47M26S = **2010-11-07 00:12:33 EST** test_time_fall_type2_post_type2_redost: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST** test_time_fall_type2_post_type2_st: ADD: 2010-11-08 19:59:59 EST + P-0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST** test_time_fall_type2_post_type2_post: ADD: 2010-11-08 18:57:55 EST + P+0Y0M0DT1H2M4S = **2010-11-08 19:59:59 EST** -test_time_fall_type2_dtsec_type2_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST** -test_time_fall_type2_stsec_type2_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT** +test_time_fall_type2_dtsec_type2_stsec: ADD: 2010-11-07 01:59:59 EDT + P+0Y0M0DT0H0M1S = **2010-11-07 02:00:00 EDT** +test_time_fall_type2_stsec_type2_dtsec: ADD: 2010-11-07 01:00:00 EST + P-0Y0M0DT0H0M1S = **2010-11-07 00:59:59 EST** diff --git a/ext/date/tests/DateTime_add-spring-type2-type2.phpt b/ext/date/tests/DateTime_add-spring-type2-type2.phpt index b64c27476..e522873b6 100644 --- a/ext/date/tests/DateTime_add-spring-type2-type2.phpt +++ b/ext/date/tests/DateTime_add-spring-type2-type2.phpt @@ -2,8 +2,6 @@ DateTime::add() -- spring type2 type2 --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Various bugs exist --FILE-- <?php @@ -15,19 +13,19 @@ require 'DateTime_data-spring-type2-type2.inc'; --EXPECT-- test_time_spring_type2_prev_type2_prev: ADD: 2010-02-11 02:18:48 EST + P+0Y1M2DT16H19M40S = **2010-03-13 18:38:28 EST** test_time_spring_type2_prev_type2_st: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST** -test_time_spring_type2_prev_type2_dt: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT** -test_time_spring_type2_prev_type2_post: ADD: 2010-03-13 18:38:28 EST + P+0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT** +test_time_spring_type2_prev_type2_dt: ADD: 2010-03-13 18:38:28 EST + P+0Y0M0DT7H38M27S = **2010-03-14 02:16:55 EST** +test_time_spring_type2_prev_type2_post: ADD: 2010-03-13 18:38:28 EST + P+0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EST** test_time_spring_type2_st_type2_prev: ADD: 2010-03-14 00:10:20 EST + P-0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST** test_time_spring_type2_st_type2_st: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT0H5M15S = **2010-03-14 00:15:35 EST** -test_time_spring_type2_st_type2_dt: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT** -test_time_spring_type2_st_type2_post: ADD: 2010-03-14 00:10:20 EST + P+0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT** -test_time_spring_type2_dt_type2_prev: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST** -test_time_spring_type2_dt_type2_st: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST** +test_time_spring_type2_st_type2_dt: ADD: 2010-03-14 00:10:20 EST + P+0Y0M0DT2H6M35S = **2010-03-14 02:16:55 EST** +test_time_spring_type2_st_type2_post: ADD: 2010-03-14 00:10:20 EST + P+0Y0M1DT18H49M39S = **2010-03-15 18:59:59 EST** +test_time_spring_type2_dt_type2_prev: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT7H38M27S = **2010-03-13 19:38:28 EDT** +test_time_spring_type2_dt_type2_st: ADD: 2010-03-14 03:16:55 EDT + P-0Y0M0DT2H6M35S = **2010-03-14 01:10:20 EDT** test_time_spring_type2_dt_type2_dt: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M0DT2H3M1S = **2010-03-14 05:19:56 EDT** test_time_spring_type2_dt_type2_post: ADD: 2010-03-14 03:16:55 EDT + P+0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT** -test_time_spring_type2_post_type2_prev: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST** -test_time_spring_type2_post_type2_st: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST** +test_time_spring_type2_post_type2_prev: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EDT** +test_time_spring_type2_post_type2_st: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT18H49M39S = **2010-03-14 01:10:20 EDT** test_time_spring_type2_post_type2_dt: ADD: 2010-03-15 19:59:59 EDT + P-0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT** test_time_spring_type2_post_type2_post: ADD: 2010-03-15 18:57:55 EDT + P+0Y0M0DT1H2M4S = **2010-03-15 19:59:59 EDT** -test_time_spring_type2_stsec_type2_dtsec: ADD: 2010-03-13 01:59:59 EST + P+0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT** -test_time_spring_type2_dtsec_type2_stsec: ADD: 2010-03-15 03:00:00 EDT + P-0Y0M0DT0H0M1S = **2010-03-15 01:59:59 EST** +test_time_spring_type2_stsec_type2_dtsec: ADD: 2010-03-14 01:59:59 EST + P+0Y0M0DT0H0M1S = **2010-03-14 02:00:00 EST** +test_time_spring_type2_dtsec_type2_stsec: ADD: 2010-03-14 03:00:00 EDT + P-0Y0M0DT0H0M1S = **2010-03-14 02:59:59 EDT** diff --git a/ext/date/tests/DateTime_data-dates.inc b/ext/date/tests/DateTime_data-dates.inc index be608dfcb..c6f04e16c 100644 --- a/ext/date/tests/DateTime_data-dates.inc +++ b/ext/date/tests/DateTime_data-dates.inc @@ -20,6 +20,7 @@ examine_diff('2007-02-07', '2000-02-07', 'P+7Y0M0DT0H0M0S', 2557); echo "test_years_positive__7_by_1_day: "; examine_diff('2007-02-08', '2000-02-07', 'P+7Y0M1DT0H0M0S', 2558); +// NOTE: sub() produces different answer. echo "test_years_positive__6_shy_1_day: "; examine_diff('2007-02-06', '2000-02-07', 'P+6Y11M30DT0H0M0S', 2556); @@ -48,6 +49,7 @@ examine_diff('2000-02-07', '2007-02-07', 'P-7Y0M0DT0H0M0S', 2557); echo "test_years_negative__7_by_1_day: "; examine_diff('2000-02-07', '2007-02-08', 'P-7Y0M1DT0H0M0S', 2558); +// NOTE: sub() produces different answer. echo "test_years_negative__6_shy_1_day: "; examine_diff('2000-02-07', '2007-02-06', 'P-6Y11M28DT0H0M0S', 2556); diff --git a/ext/date/tests/DateTime_data-february.inc b/ext/date/tests/DateTime_data-february.inc index 8c31ef69a..cc9d85df0 100644 --- a/ext/date/tests/DateTime_data-february.inc +++ b/ext/date/tests/DateTime_data-february.inc @@ -71,15 +71,19 @@ examine_diff('2010-03-01', '2010-01-01', 'P+0Y2M0DT0H0M0S', 59); echo "test_bug_49081__20: "; examine_diff('2010-03-01', '2010-01-31', 'P+0Y0M29DT0H0M0S', 29); +// NOTE: sub() produces different answer. echo "test_bug_49081__21: "; examine_diff('2010-03-27', '2010-01-31', 'P+0Y1M24DT0H0M0S', 55); +// NOTE: sub() produces different answer. echo "test_bug_49081__22: "; examine_diff('2010-03-28', '2010-01-31', 'P+0Y1M25DT0H0M0S', 56); +// NOTE: sub() produces different answer. echo "test_bug_49081__23: "; examine_diff('2010-03-29', '2010-01-31', 'P+0Y1M26DT0H0M0S', 57); +// NOTE: sub() produces different answer. echo "test_bug_49081__24: "; examine_diff('2010-03-30', '2010-01-31', 'P+0Y1M27DT0H0M0S', 58); @@ -168,18 +172,23 @@ examine_diff('2010-01-27', '2010-02-28', 'P-0Y1M1DT0H0M0S', 32); echo "test_bug_49081_negative__19: "; examine_diff('2010-01-01', '2010-03-01', 'P-0Y2M0DT0H0M0S', 59); +// NOTE: sub() produces different answer. echo "test_bug_49081_negative__20: "; examine_diff('2010-01-31', '2010-03-01', 'P-0Y1M1DT0H0M0S', 29); +// NOTE: sub() produces different answer. echo "test_bug_49081_negative__21: "; examine_diff('2010-01-31', '2010-03-27', 'P-0Y1M27DT0H0M0S', 55); +// NOTE: sub() produces different answer. echo "test_bug_49081_negative__22: "; examine_diff('2010-01-31', '2010-03-28', 'P-0Y1M28DT0H0M0S', 56); +// NOTE: sub() produces different answer. echo "test_bug_49081_negative__23: "; examine_diff('2010-01-31', '2010-03-29', 'P-0Y1M29DT0H0M0S', 57); +// NOTE: sub() produces different answer. echo "test_bug_49081_negative__24: "; examine_diff('2010-01-31', '2010-03-30', 'P-0Y1M30DT0H0M0S', 58); diff --git a/ext/date/tests/DateTime_data-spring-type2-type2.inc b/ext/date/tests/DateTime_data-spring-type2-type2.inc index 3556b207b..d9e07c313 100644 --- a/ext/date/tests/DateTime_data-spring-type2-type2.inc +++ b/ext/date/tests/DateTime_data-spring-type2-type2.inc @@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55 EDT'); // sp post, zt2 examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0); echo "test_time_spring_type2_stsec_type2_dtsec: "; -$end = new DateTime('2010-03-15 03:00:00 EDT'); // dtsec, zt2 -$start = new DateTime('2010-03-13 01:59:59 EST'); // stsec, zt2 +$end = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2 +$start = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2 examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0); echo "test_time_spring_type2_dtsec_type2_stsec: "; -$end = new DateTime('2010-03-15 01:59:59 EST'); // stsec, zt2 -$start = new DateTime('2010-03-13 03:00:00 EDT'); // dtsec, zt2 +$end = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2 +$start = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2 examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0); diff --git a/ext/date/tests/DateTime_data-spring-type2-type3.inc b/ext/date/tests/DateTime_data-spring-type2-type3.inc index b06825837..d66fc5177 100644 --- a/ext/date/tests/DateTime_data-spring-type2-type3.inc +++ b/ext/date/tests/DateTime_data-spring-type2-type3.inc @@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55 EDT'); // sp post, zt2 examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0); echo "test_time_spring_type2_stsec_type3_dtsec: "; -$end = new DateTime('2010-03-15 03:00:00'); // dtsec, zt3 -$start = new DateTime('2010-03-13 01:59:59 EST'); // stsec, zt2 +$end = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3 +$start = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2 examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0); echo "test_time_spring_type2_dtsec_type3_stsec: "; -$end = new DateTime('2010-03-15 01:59:59'); // stsec, zt3 -$start = new DateTime('2010-03-13 03:00:00 EDT'); // dtsec, zt2 +$end = new DateTime('2010-03-14 01:59:59'); // stsec, zt3 +$start = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2 examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0); diff --git a/ext/date/tests/DateTime_data-spring-type3-type2.inc b/ext/date/tests/DateTime_data-spring-type3-type2.inc index 244cd5881..92211f4b1 100644 --- a/ext/date/tests/DateTime_data-spring-type3-type2.inc +++ b/ext/date/tests/DateTime_data-spring-type3-type2.inc @@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55'); // sp post, zt3 examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0); echo "test_time_spring_type3_stsec_type2_dtsec: "; -$end = new DateTime('2010-03-15 03:00:00 EDT'); // dtsec, zt2 -$start = new DateTime('2010-03-13 01:59:59'); // stsec, zt3 +$end = new DateTime('2010-03-14 03:00:00 EDT'); // dtsec, zt2 +$start = new DateTime('2010-03-14 01:59:59'); // stsec, zt3 examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0); echo "test_time_spring_type3_dtsec_type2_stsec: "; -$end = new DateTime('2010-03-15 01:59:59 EST'); // stsec, zt2 -$start = new DateTime('2010-03-13 03:00:00'); // dtsec, zt3 +$end = new DateTime('2010-03-14 01:59:59 EST'); // stsec, zt2 +$start = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3 examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0); diff --git a/ext/date/tests/DateTime_data-spring-type3-type3.inc b/ext/date/tests/DateTime_data-spring-type3-type3.inc index d87373c5a..de1dee12e 100644 --- a/ext/date/tests/DateTime_data-spring-type3-type3.inc +++ b/ext/date/tests/DateTime_data-spring-type3-type3.inc @@ -99,11 +99,11 @@ $start = new DateTime('2010-03-15 18:57:55'); // sp post, zt3 examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0); echo "test_time_spring_type3_stsec_type3_dtsec: "; -$end = new DateTime('2010-03-15 03:00:00'); // dtsec, zt3 -$start = new DateTime('2010-03-13 01:59:59'); // stsec, zt3 +$end = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3 +$start = new DateTime('2010-03-14 01:59:59'); // stsec, zt3 examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0); echo "test_time_spring_type3_dtsec_type3_stsec: "; -$end = new DateTime('2010-03-15 01:59:59'); // stsec, zt3 -$start = new DateTime('2010-03-13 03:00:00'); // dtsec, zt3 +$end = new DateTime('2010-03-14 01:59:59'); // stsec, zt3 +$start = new DateTime('2010-03-14 03:00:00'); // dtsec, zt3 examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0); diff --git a/ext/date/tests/DateTime_days-spring-type2-type2.phpt b/ext/date/tests/DateTime_days-spring-type2-type2.phpt index 3f9c35352..3e702ace0 100644 --- a/ext/date/tests/DateTime_days-spring-type2-type2.phpt +++ b/ext/date/tests/DateTime_days-spring-type2-type2.phpt @@ -27,5 +27,5 @@ test_time_spring_type2_post_type2_prev: DAYS: **2** test_time_spring_type2_post_type2_st: DAYS: **1** test_time_spring_type2_post_type2_dt: DAYS: **1** test_time_spring_type2_post_type2_post: DAYS: **0** -test_time_spring_type2_stsec_type2_dtsec: DAYS: **0** +test_time_spring_type2_stsec_type2_dtsec: DAYS: **0** test_time_spring_type2_dtsec_type2_stsec: DAYS: **0** diff --git a/ext/date/tests/DateTime_days-spring-type2-type3.phpt b/ext/date/tests/DateTime_days-spring-type2-type3.phpt index 77ac5fdb6..0e23ac3e2 100644 --- a/ext/date/tests/DateTime_days-spring-type2-type3.phpt +++ b/ext/date/tests/DateTime_days-spring-type2-type3.phpt @@ -27,5 +27,5 @@ test_time_spring_type2_post_type3_prev: DAYS: **2** test_time_spring_type2_post_type3_st: DAYS: **1** test_time_spring_type2_post_type3_dt: DAYS: **1** test_time_spring_type2_post_type3_post: DAYS: **0** -test_time_spring_type2_stsec_type3_dtsec: DAYS: **0** +test_time_spring_type2_stsec_type3_dtsec: DAYS: **0** test_time_spring_type2_dtsec_type3_stsec: DAYS: **0** diff --git a/ext/date/tests/DateTime_days-spring-type3-type2.phpt b/ext/date/tests/DateTime_days-spring-type3-type2.phpt index 09aa8d9c1..4fb9ba76d 100644 --- a/ext/date/tests/DateTime_days-spring-type3-type2.phpt +++ b/ext/date/tests/DateTime_days-spring-type3-type2.phpt @@ -27,5 +27,5 @@ test_time_spring_type3_post_type2_prev: DAYS: **2** test_time_spring_type3_post_type2_st: DAYS: **1** test_time_spring_type3_post_type2_dt: DAYS: **1** test_time_spring_type3_post_type2_post: DAYS: **0** -test_time_spring_type3_stsec_type2_dtsec: DAYS: **0** +test_time_spring_type3_stsec_type2_dtsec: DAYS: **0** test_time_spring_type3_dtsec_type2_stsec: DAYS: **0** diff --git a/ext/date/tests/DateTime_days-spring-type3-type3.phpt b/ext/date/tests/DateTime_days-spring-type3-type3.phpt index f947329de..df44925fb 100644 --- a/ext/date/tests/DateTime_days-spring-type3-type3.phpt +++ b/ext/date/tests/DateTime_days-spring-type3-type3.phpt @@ -27,5 +27,5 @@ test_time_spring_type3_post_type3_prev: DAYS: **2** test_time_spring_type3_post_type3_st: DAYS: **1** test_time_spring_type3_post_type3_dt: DAYS: **1** test_time_spring_type3_post_type3_post: DAYS: **0** -test_time_spring_type3_stsec_type3_dtsec: DAYS: **0** +test_time_spring_type3_stsec_type3_dtsec: DAYS: **0** test_time_spring_type3_dtsec_type3_stsec: DAYS: **0** diff --git a/ext/date/tests/DateTime_diff-fall-type2-type2.phpt b/ext/date/tests/DateTime_diff-fall-type2-type2.phpt index 3e7cf7dbf..d655637ac 100644 --- a/ext/date/tests/DateTime_diff-fall-type2-type2.phpt +++ b/ext/date/tests/DateTime_diff-fall-type2-type2.phpt @@ -2,8 +2,6 @@ DateTime::diff() -- fall type2 type2 --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Various bugs exist --FILE-- <?php @@ -18,7 +16,7 @@ test_time_fall_type2_prev_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-06 1 test_time_fall_type2_prev_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT6H34M5S** test_time_fall_type2_prev_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT7H36M16S** test_time_fall_type2_prev_type2_st: DIFF: 2010-11-07 03:16:55 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M0DT9H38M27S** -test_time_fall_type2_prev_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT1H21M31S** +test_time_fall_type2_prev_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-06 18:38:28 EDT = **P+0Y0M2DT2H21M31S** test_time_fall_type2_dt_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-07 00:10:20 EDT = **P-0Y0M0DT5H31M52S** test_time_fall_type2_dt_type2_dt: DIFF: 2010-11-07 00:15:35 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT0H5M15S** test_time_fall_type2_dt_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 00:10:20 EDT = **P+0Y0M0DT1H2M13S** @@ -43,7 +41,7 @@ test_time_fall_type2_st_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-07 test_time_fall_type2_st_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-07 03:16:55 EST = **P-0Y0M0DT2H2M11S** test_time_fall_type2_st_type2_st: DIFF: 2010-11-07 05:19:56 EST - 2010-11-07 03:16:55 EST = **P+0Y0M0DT2H3M1S** test_time_fall_type2_st_type2_post: DIFF: 2010-11-08 19:59:59 EST - 2010-11-07 03:16:55 EST = **P+0Y0M1DT16H43M4S** -test_time_fall_type2_post_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT1H21M31S** +test_time_fall_type2_post_type2_prev: DIFF: 2010-11-06 18:38:28 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M2DT2H21M31S** test_time_fall_type2_post_type2_dt: DIFF: 2010-11-07 00:10:20 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT20H49M39S** test_time_fall_type2_post_type2_redodt: DIFF: 2010-11-07 01:12:33 EDT - 2010-11-08 19:59:59 EST = **P-0Y0M1DT19H47M26S** test_time_fall_type2_post_type2_redost: DIFF: 2010-11-07 01:14:44 EST - 2010-11-08 19:59:59 EST = **P-0Y0M1DT18H45M15S** diff --git a/ext/date/tests/DateTime_diff-spring-type2-type2.phpt b/ext/date/tests/DateTime_diff-spring-type2-type2.phpt index 4c590cd99..730cfd11e 100644 --- a/ext/date/tests/DateTime_diff-spring-type2-type2.phpt +++ b/ext/date/tests/DateTime_diff-spring-type2-type2.phpt @@ -2,8 +2,6 @@ DateTime::diff() -- spring type2 type2 --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Various bugs exist --FILE-- <?php @@ -16,7 +14,7 @@ require 'DateTime_data-spring-type2-type2.inc'; test_time_spring_type2_prev_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-02-11 02:18:48 EST = **P+0Y1M2DT16H19M40S** test_time_spring_type2_prev_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-13 18:38:28 EST = **P+0Y0M0DT5H31M52S** test_time_spring_type2_prev_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M0DT7H38M27S** -test_time_spring_type2_prev_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M2DT1H21M31S** +test_time_spring_type2_prev_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-13 18:38:28 EST = **P+0Y0M2DT0H21M31S** test_time_spring_type2_st_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 00:10:20 EST = **P-0Y0M0DT5H31M52S** test_time_spring_type2_st_type2_st: DIFF: 2010-03-14 00:15:35 EST - 2010-03-14 00:10:20 EST = **P+0Y0M0DT0H5M15S** test_time_spring_type2_st_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-14 00:10:20 EST = **P+0Y0M0DT2H6M35S** @@ -25,9 +23,9 @@ test_time_spring_type2_dt_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-14 test_time_spring_type2_dt_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-14 03:16:55 EDT = **P-0Y0M0DT2H6M35S** test_time_spring_type2_dt_type2_dt: DIFF: 2010-03-14 05:19:56 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M0DT2H3M1S** test_time_spring_type2_dt_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-14 03:16:55 EDT = **P+0Y0M1DT16H43M4S** -test_time_spring_type2_post_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M2DT1H21M31S** +test_time_spring_type2_post_type2_prev: DIFF: 2010-03-13 18:38:28 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M2DT0H21M31S** test_time_spring_type2_post_type2_st: DIFF: 2010-03-14 00:10:20 EST - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT18H49M39S** test_time_spring_type2_post_type2_dt: DIFF: 2010-03-14 03:16:55 EDT - 2010-03-15 19:59:59 EDT = **P-0Y0M1DT16H43M4S** test_time_spring_type2_post_type2_post: DIFF: 2010-03-15 19:59:59 EDT - 2010-03-15 18:57:55 EDT = **P+0Y0M0DT1H2M4S** -test_time_spring_type2_stsec_type2_dtsec: DIFF: 2010-03-15 03:00:00 EDT - 2010-03-13 01:59:59 EST = **P+0Y0M0DT0H0M1S** -test_time_spring_type2_dtsec_type2_stsec: DIFF: 2010-03-15 01:59:59 EST - 2010-03-15 03:00:00 EDT = **P-0Y0M0DT0H0M1S** +test_time_spring_type2_stsec_type2_dtsec: DIFF: 2010-03-14 03:00:00 EDT - 2010-03-14 01:59:59 EST = **P+0Y0M0DT0H0M1S** +test_time_spring_type2_dtsec_type2_stsec: DIFF: 2010-03-14 01:59:59 EST - 2010-03-14 03:00:00 EDT = **P-0Y0M0DT0H0M1S** diff --git a/ext/date/tests/DateTime_sub-dates.phpt b/ext/date/tests/DateTime_sub-dates.phpt index 36ca25c16..26f49ba83 100644 --- a/ext/date/tests/DateTime_sub-dates.phpt +++ b/ext/date/tests/DateTime_sub-dates.phpt @@ -14,7 +14,7 @@ require 'DateTime_data-dates.inc'; test__7: SUB: 2009-01-14 00:00:00 EST - P+0Y0M7DT0H0M0S = **2009-01-07 00:00:00 EST** test_years_positive__7_by_0_day: SUB: 2007-02-07 00:00:00 EST - P+7Y0M0DT0H0M0S = **2000-02-07 00:00:00 EST** test_years_positive__7_by_1_day: SUB: 2007-02-08 00:00:00 EST - P+7Y0M1DT0H0M0S = **2000-02-07 00:00:00 EST** -test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-07 00:00:00 EST** +test_years_positive__6_shy_1_day: SUB: 2007-02-06 00:00:00 EST - P+6Y11M30DT0H0M0S = **2000-02-05 00:00:00 EST** test_years_positive__7_by_1_month: SUB: 2007-03-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **2000-02-07 00:00:00 EST** test_years_positive__6_shy_1_month: SUB: 2007-01-07 00:00:00 EST - P+6Y11M0DT0H0M0S = **2000-02-07 00:00:00 EST** test_years_positive__7_by_1_month_split_newyear: SUB: 2007-01-07 00:00:00 EST - P+7Y1M0DT0H0M0S = **1999-12-07 00:00:00 EST** @@ -22,7 +22,7 @@ test_years_positive__6_shy_1_month_split_newyear: SUB: 2006-12-07 00:00:00 EST - test_negative__7: SUB: 2009-01-07 00:00:00 EST - P-0Y0M7DT0H0M0S = **2009-01-14 00:00:00 EST** test_years_negative__7_by_0_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M0DT0H0M0S = **2007-02-07 00:00:00 EST** test_years_negative__7_by_1_day: SUB: 2000-02-07 00:00:00 EST - P-7Y0M1DT0H0M0S = **2007-02-08 00:00:00 EST** -test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-06 00:00:00 EST** +test_years_negative__6_shy_1_day: SUB: 2000-02-07 00:00:00 EST - P-6Y11M28DT0H0M0S = **2007-02-04 00:00:00 EST** test_years_negative__7_by_1_month: SUB: 2000-02-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-03-07 00:00:00 EST** test_years_negative__6_shy_1_month: SUB: 2000-02-07 00:00:00 EST - P-6Y11M0DT0H0M0S = **2007-01-07 00:00:00 EST** test_years_negative__7_by_1_month_split_newyear: SUB: 1999-12-07 00:00:00 EST - P-7Y1M0DT0H0M0S = **2007-01-07 00:00:00 EST** diff --git a/ext/date/tests/DateTime_sub-fall-type2-type2.phpt b/ext/date/tests/DateTime_sub-fall-type2-type2.phpt index 3138e1cd8..e133b1f4d 100644 --- a/ext/date/tests/DateTime_sub-fall-type2-type2.phpt +++ b/ext/date/tests/DateTime_sub-fall-type2-type2.phpt @@ -2,8 +2,6 @@ DateTime::sub() -- fall type2 type2 --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Various bugs exist --FILE-- <?php @@ -16,38 +14,38 @@ require 'DateTime_data-fall-type2-type2.inc'; test_time_fall_type2_prev_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P+0Y1M2DT16H19M40S = **2010-10-04 02:18:48 EDT** test_time_fall_type2_prev_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P+0Y0M0DT5H31M52S = **2010-11-06 18:38:28 EDT** test_time_fall_type2_prev_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT6H34M5S = **2010-11-06 18:38:28 EDT** -test_time_fall_type2_prev_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT7H36M16S = **2010-11-06 18:38:28 EDT** -test_time_fall_type2_prev_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT9H38M27S = **2010-11-06 18:38:28 EDT** -test_time_fall_type2_prev_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EDT** +test_time_fall_type2_prev_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT7H36M16S = **2010-11-06 17:38:28 EST** +test_time_fall_type2_prev_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT9H38M27S = **2010-11-06 17:38:28 EST** +test_time_fall_type2_prev_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M2DT1H21M31S = **2010-11-06 18:38:28 EST** test_time_fall_type2_dt_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT5H31M52S = **2010-11-07 00:10:20 EDT** test_time_fall_type2_dt_type2_dt: SUB: 2010-11-07 00:15:35 EDT - P+0Y0M0DT0H5M15S = **2010-11-07 00:10:20 EDT** test_time_fall_type2_dt_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P+0Y0M0DT1H2M13S = **2010-11-07 00:10:20 EDT** -test_time_fall_type2_dt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT2H4M24S = **2010-11-07 00:10:20 EDT** -test_time_fall_type2_dt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT4H6M35S = **2010-11-07 00:10:20 EDT** -test_time_fall_type2_dt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT20H49M39S = **2010-11-07 00:10:20 EDT** +test_time_fall_type2_dt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT2H4M24S = **2010-11-06 23:10:20 EST** +test_time_fall_type2_dt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT4H6M35S = **2010-11-06 23:10:20 EST** +test_time_fall_type2_dt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT20H49M39S = **2010-11-06 23:10:20 EST** test_time_fall_type2_redodt_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT6H34M5S = **2010-11-07 01:12:33 EDT** test_time_fall_type2_redodt_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT1H2M13S = **2010-11-07 01:12:33 EDT** test_time_fall_type2_redodt_type2_redodt: SUB: 2010-11-07 01:15:35 EDT - P+0Y0M0DT0H3M2S = **2010-11-07 01:12:33 EDT** -test_time_fall_type2_redodt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT1H2M11S = **2010-11-07 01:12:33 EDT** -test_time_fall_type2_redodt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT3H4M22S = **2010-11-07 01:12:33 EDT** -test_time_fall_type2_redodt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT19H47M26S = **2010-11-07 01:12:33 EDT** -test_time_fall_type2_redost_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT7H36M16S = **2010-11-07 01:14:44 EST** -test_time_fall_type2_redost_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT2H4M24S = **2010-11-07 01:14:44 EST** -test_time_fall_type2_redost_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT1H2M11S = **2010-11-07 01:14:44 EST** +test_time_fall_type2_redodt_type2_redost: SUB: 2010-11-07 01:14:44 EST - P+0Y0M0DT1H2M11S = **2010-11-07 00:12:33 EST** +test_time_fall_type2_redodt_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT3H4M22S = **2010-11-07 00:12:33 EST** +test_time_fall_type2_redodt_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT19H47M26S = **2010-11-07 00:12:33 EST** +test_time_fall_type2_redost_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT7H36M16S = **2010-11-07 02:14:44 EDT** +test_time_fall_type2_redost_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT2H4M24S = **2010-11-07 02:14:44 EDT** +test_time_fall_type2_redost_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT1H2M11S = **2010-11-07 02:14:44 EDT** test_time_fall_type2_redost_type2_redost: SUB: 2010-11-07 01:16:54 EST - P+0Y0M0DT0H2M10S = **2010-11-07 01:14:44 EST** test_time_fall_type2_redost_type2_st: SUB: 2010-11-07 03:16:55 EST - P+0Y0M0DT2H2M11S = **2010-11-07 01:14:44 EST** test_time_fall_type2_redost_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT18H45M15S = **2010-11-07 01:14:44 EST** -test_time_fall_type2_st_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT9H38M27S = **2010-11-07 03:16:55 EST** -test_time_fall_type2_st_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT4H6M35S = **2010-11-07 03:16:55 EST** -test_time_fall_type2_st_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT3H4M22S = **2010-11-07 03:16:55 EST** +test_time_fall_type2_st_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M0DT9H38M27S = **2010-11-07 04:16:55 EDT** +test_time_fall_type2_st_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M0DT4H6M35S = **2010-11-07 04:16:55 EDT** +test_time_fall_type2_st_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M0DT3H4M22S = **2010-11-07 04:16:55 EDT** test_time_fall_type2_st_type2_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M0DT2H2M11S = **2010-11-07 03:16:55 EST** test_time_fall_type2_st_type2_st: SUB: 2010-11-07 05:19:56 EST - P+0Y0M0DT2H3M1S = **2010-11-07 03:16:55 EST** test_time_fall_type2_st_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M1DT16H43M4S = **2010-11-07 03:16:55 EST** -test_time_fall_type2_post_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EST** -test_time_fall_type2_post_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M1DT20H49M39S = **2010-11-08 19:59:59 EST** -test_time_fall_type2_post_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M1DT19H47M26S = **2010-11-08 19:59:59 EST** +test_time_fall_type2_post_type2_prev: SUB: 2010-11-06 18:38:28 EDT - P-0Y0M2DT1H21M31S = **2010-11-08 19:59:59 EDT** +test_time_fall_type2_post_type2_dt: SUB: 2010-11-07 00:10:20 EDT - P-0Y0M1DT20H49M39S = **2010-11-08 20:59:59 EDT** +test_time_fall_type2_post_type2_redodt: SUB: 2010-11-07 01:12:33 EDT - P-0Y0M1DT19H47M26S = **2010-11-08 20:59:59 EDT** test_time_fall_type2_post_type2_redost: SUB: 2010-11-07 01:14:44 EST - P-0Y0M1DT18H45M15S = **2010-11-08 19:59:59 EST** test_time_fall_type2_post_type2_st: SUB: 2010-11-07 03:16:55 EST - P-0Y0M1DT16H43M4S = **2010-11-08 19:59:59 EST** test_time_fall_type2_post_type2_post: SUB: 2010-11-08 19:59:59 EST - P+0Y0M0DT1H2M4S = **2010-11-08 18:57:55 EST** -test_time_fall_type2_dtsec_type2_stsec: SUB: 2010-11-07 01:00:00 EST - P+0Y0M0DT0H0M1S = **2010-11-07 01:59:59 EDT** -test_time_fall_type2_stsec_type2_dtsec: SUB: 2010-11-07 01:59:59 EDT - P-0Y0M0DT0H0M1S = **2010-11-07 01:00:00 EST** +test_time_fall_type2_dtsec_type2_stsec: SUB: 2010-11-07 01:00:00 EST - P+0Y0M0DT0H0M1S = **2010-11-07 00:59:59 EST** +test_time_fall_type2_stsec_type2_dtsec: SUB: 2010-11-07 01:59:59 EDT - P-0Y0M0DT0H0M1S = **2010-11-07 02:00:00 EDT** diff --git a/ext/date/tests/DateTime_sub-february.phpt b/ext/date/tests/DateTime_sub-february.phpt index 89cba4bde..23c8da447 100644 --- a/ext/date/tests/DateTime_sub-february.phpt +++ b/ext/date/tests/DateTime_sub-february.phpt @@ -31,10 +31,10 @@ test_bug_49081__17: SUB: 2010-02-28 00:00:00 EST - P+0Y1M0DT0H0M0S = **2010-01-2 test_bug_49081__18: SUB: 2010-02-28 00:00:00 EST - P+0Y1M1DT0H0M0S = **2010-01-27 00:00:00 EST** test_bug_49081__19: SUB: 2010-03-01 00:00:00 EST - P+0Y2M0DT0H0M0S = **2010-01-01 00:00:00 EST** test_bug_49081__20: SUB: 2010-03-01 00:00:00 EST - P+0Y0M29DT0H0M0S = **2010-01-31 00:00:00 EST** -test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-01-31 00:00:00 EST** -test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-01-31 00:00:00 EST** -test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-01-31 00:00:00 EST** -test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-01-31 00:00:00 EST** +test_bug_49081__21: SUB: 2010-03-27 00:00:00 EDT - P+0Y1M24DT0H0M0S = **2010-02-03 00:00:00 EST** +test_bug_49081__22: SUB: 2010-03-28 00:00:00 EDT - P+0Y1M25DT0H0M0S = **2010-02-03 00:00:00 EST** +test_bug_49081__23: SUB: 2010-03-29 00:00:00 EDT - P+0Y1M26DT0H0M0S = **2010-02-03 00:00:00 EST** +test_bug_49081__24: SUB: 2010-03-30 00:00:00 EDT - P+0Y1M27DT0H0M0S = **2010-02-03 00:00:00 EST** test_bug_49081__25: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M0DT0H0M0S = **2010-01-31 00:00:00 EST** test_bug_49081__26: SUB: 2010-03-31 00:00:00 EDT - P+0Y2M1DT0H0M0S = **2010-01-30 00:00:00 EST** test_bug_49081__27: SUB: 2009-01-31 00:00:00 EST - P+0Y0M30DT0H0M0S = **2009-01-01 00:00:00 EST** @@ -62,11 +62,11 @@ test_bug_49081_negative__16: SUB: 2010-01-29 00:00:00 EST - P-0Y0M30DT0H0M0S = * test_bug_49081_negative__17: SUB: 2010-01-28 00:00:00 EST - P-0Y1M0DT0H0M0S = **2010-02-28 00:00:00 EST** test_bug_49081_negative__18: SUB: 2010-01-27 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-02-28 00:00:00 EST** test_bug_49081_negative__19: SUB: 2010-01-01 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-01 00:00:00 EST** -test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-01 00:00:00 EST** -test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-27 00:00:00 EDT** -test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-28 00:00:00 EDT** -test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-03-29 00:00:00 EDT** -test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-03-30 00:00:00 EDT** +test_bug_49081_negative__20: SUB: 2010-01-31 00:00:00 EST - P-0Y1M1DT0H0M0S = **2010-03-04 00:00:00 EST** +test_bug_49081_negative__21: SUB: 2010-01-31 00:00:00 EST - P-0Y1M27DT0H0M0S = **2010-03-30 00:00:00 EDT** +test_bug_49081_negative__22: SUB: 2010-01-31 00:00:00 EST - P-0Y1M28DT0H0M0S = **2010-03-31 00:00:00 EDT** +test_bug_49081_negative__23: SUB: 2010-01-31 00:00:00 EST - P-0Y1M29DT0H0M0S = **2010-04-01 00:00:00 EDT** +test_bug_49081_negative__24: SUB: 2010-01-31 00:00:00 EST - P-0Y1M30DT0H0M0S = **2010-04-02 00:00:00 EDT** test_bug_49081_negative__25: SUB: 2010-01-31 00:00:00 EST - P-0Y2M0DT0H0M0S = **2010-03-31 00:00:00 EDT** test_bug_49081_negative__26: SUB: 2010-01-30 00:00:00 EST - P-0Y2M1DT0H0M0S = **2010-03-31 00:00:00 EDT** test_bug_49081_negative__27: SUB: 2009-01-01 00:00:00 EST - P-0Y0M30DT0H0M0S = **2009-01-31 00:00:00 EST** diff --git a/ext/date/tests/DateTime_sub-spring-type2-type2.phpt b/ext/date/tests/DateTime_sub-spring-type2-type2.phpt index 2b1817d79..925f1411e 100644 --- a/ext/date/tests/DateTime_sub-spring-type2-type2.phpt +++ b/ext/date/tests/DateTime_sub-spring-type2-type2.phpt @@ -2,8 +2,6 @@ DateTime::sub() -- spring type2 type2 --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Various bugs exist --FILE-- <?php @@ -15,19 +13,19 @@ require 'DateTime_data-spring-type2-type2.inc'; --EXPECT-- test_time_spring_type2_prev_type2_prev: SUB: 2010-03-13 18:38:28 EST - P+0Y1M2DT16H19M40S = **2010-02-11 02:18:48 EST** test_time_spring_type2_prev_type2_st: SUB: 2010-03-14 00:10:20 EST - P+0Y0M0DT5H31M52S = **2010-03-13 18:38:28 EST** -test_time_spring_type2_prev_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT7H38M27S = **2010-03-13 18:38:28 EST** -test_time_spring_type2_prev_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EST** +test_time_spring_type2_prev_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT7H38M27S = **2010-03-13 19:38:28 EDT** +test_time_spring_type2_prev_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M2DT1H21M31S = **2010-03-13 18:38:28 EDT** test_time_spring_type2_st_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT5H31M52S = **2010-03-14 00:10:20 EST** test_time_spring_type2_st_type2_st: SUB: 2010-03-14 00:15:35 EST - P+0Y0M0DT0H5M15S = **2010-03-14 00:10:20 EST** -test_time_spring_type2_st_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT2H6M35S = **2010-03-14 00:10:20 EST** -test_time_spring_type2_st_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT18H49M39S = **2010-03-14 00:10:20 EST** -test_time_spring_type2_dt_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT7H38M27S = **2010-03-14 03:16:55 EDT** -test_time_spring_type2_dt_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M0DT2H6M35S = **2010-03-14 03:16:55 EDT** +test_time_spring_type2_st_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P+0Y0M0DT2H6M35S = **2010-03-14 01:10:20 EDT** +test_time_spring_type2_st_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT18H49M39S = **2010-03-14 01:10:20 EDT** +test_time_spring_type2_dt_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M0DT7H38M27S = **2010-03-14 02:16:55 EST** +test_time_spring_type2_dt_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M0DT2H6M35S = **2010-03-14 02:16:55 EST** test_time_spring_type2_dt_type2_dt: SUB: 2010-03-14 05:19:56 EDT - P+0Y0M0DT2H3M1S = **2010-03-14 03:16:55 EDT** test_time_spring_type2_dt_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M1DT16H43M4S = **2010-03-14 03:16:55 EDT** -test_time_spring_type2_post_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EDT** -test_time_spring_type2_post_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M1DT18H49M39S = **2010-03-15 19:59:59 EDT** +test_time_spring_type2_post_type2_prev: SUB: 2010-03-13 18:38:28 EST - P-0Y0M2DT1H21M31S = **2010-03-15 19:59:59 EST** +test_time_spring_type2_post_type2_st: SUB: 2010-03-14 00:10:20 EST - P-0Y0M1DT18H49M39S = **2010-03-15 18:59:59 EST** test_time_spring_type2_post_type2_dt: SUB: 2010-03-14 03:16:55 EDT - P-0Y0M1DT16H43M4S = **2010-03-15 19:59:59 EDT** test_time_spring_type2_post_type2_post: SUB: 2010-03-15 19:59:59 EDT - P+0Y0M0DT1H2M4S = **2010-03-15 18:57:55 EDT** -test_time_spring_type2_stsec_type2_dtsec: SUB: 2010-03-15 03:00:00 EDT - P+0Y0M0DT0H0M1S = **2010-03-13 01:59:59 EST** -test_time_spring_type2_dtsec_type2_stsec: SUB: 2010-03-15 01:59:59 EST - P-0Y0M0DT0H0M1S = **2010-03-15 03:00:00 EDT** +test_time_spring_type2_stsec_type2_dtsec: SUB: 2010-03-14 03:00:00 EDT - P+0Y0M0DT0H0M1S = **2010-03-14 02:59:59 EDT** +test_time_spring_type2_dtsec_type2_stsec: SUB: 2010-03-14 01:59:59 EST - P-0Y0M0DT0H0M1S = **2010-03-14 02:00:00 EST** diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt index 60fc7e7f6..5254142ba 100644 --- a/ext/date/tests/bug13142.phpt +++ b/ext/date/tests/bug13142.phpt @@ -4,6 +4,9 @@ Bug #13142 (strtotime handling of "M d H:i:s Y" format) date.timezone=US/Eastern --SKIPIF-- <?php +if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + die("skip. set TZ env is not supported at runtime."); +} if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { die("skip unable to change TZ enviroment variable\n"); } diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt index bd3bc949b..af35b8fbf 100644 --- a/ext/date/tests/bug27780.phpt +++ b/ext/date/tests/bug27780.phpt @@ -1,5 +1,10 @@ --TEST-- Bug #27780 (strtotime(+1 xxx) returns a wrong date/time) +--SKIPIF-- +<?php +if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + die("skip. Not the same TZ on windows."); +} --FILE-- <?php $timezones = array ( diff --git a/ext/date/tests/bug28088.phpt b/ext/date/tests/bug28088.phpt index 95866e00b..c31013938 100644 --- a/ext/date/tests/bug28088.phpt +++ b/ext/date/tests/bug28088.phpt @@ -1,9 +1,9 @@ --TEST-- Bug #28088 (strtotime() cannot convert 00 hours") +--INI-- +date.timezone=UTC --FILE-- <?php -putenv("TZ=GMT"); - echo "The following line rightly shows the correct date time:\n"; echo gmdate("m/d/y Hi", strtotime("04/04/04 2345")), "\n"; diff --git a/ext/date/tests/bug32555.phpt b/ext/date/tests/bug32555.phpt index a99d3e289..fca34ffa1 100644 --- a/ext/date/tests/bug32555.phpt +++ b/ext/date/tests/bug32555.phpt @@ -1,10 +1,13 @@ --TEST-- Bug #32555 (strtotime("tomorrow") can return false) +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip strftime uses system TZ'); +?> --INI-- date.timezone=US/Eastern --FILE-- <?php - $stamp = 1112427000; print strftime('%c %Z',strtotime('now',$stamp)) ."\n"; print strftime('%c %Z',strtotime('tomorrow',$stamp)) ."\n"; diff --git a/ext/date/tests/bug33415-2.phpt b/ext/date/tests/bug33415-2.phpt index 9ea537a9f..424be76fc 100644 --- a/ext/date/tests/bug33415-2.phpt +++ b/ext/date/tests/bug33415-2.phpt @@ -2,10 +2,10 @@ Bug #33415 [2] (Possibly invalid non-one-hour DST or timezone shifts) --FILE-- <?php +date_default_timezone_set('Africa/Bujumbura'); print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Africa/Bujumbura"); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Wednesday", $tStamp); @@ -13,7 +13,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Wednesday 00:00:00\n\n"; print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes\n"; -putenv("TZ=Asia/Thimbu"); +date_default_timezone_set('Asia/Thimbu'); $tStamp = mktime (17, 17, 17, 1, 6476, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -22,7 +22,7 @@ print "wanted=Thursday 00:30:00\n\n"; print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Indian/Cocos"); +date_default_timezone_set('Indian/Cocos'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -31,7 +31,7 @@ print "wanted=Thursday 00:00:00\n\n"; print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Africa/Lubumbashi"); +date_default_timezone_set('Africa/Lubumbashi'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Saturday", $tStamp); @@ -39,7 +39,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Saturday 00:00:00\n\n"; print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes\n"; -putenv("TZ=Asia/Kashgar"); +date_default_timezone_set('Asia/Kashgar'); $tStamp = mktime (17, 17, 17, 1, 3767, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -48,7 +48,7 @@ print "wanted=Thursday 03:00:00\n\n"; print "TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Indian/Christmas"); +date_default_timezone_set('Indian/Christmas'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -56,7 +56,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Sunday 00:00:00\n\n"; print "TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes\n"; -putenv("TZ=America/Santo_Domingo"); +date_default_timezone_set('America/Santo_Domingo'); $tStamp = mktime (17, 17, 17, 1, 291, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -65,7 +65,7 @@ print "wanted=Sunday 00:30:00\n\n"; print "TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Pacific/Truk"); +date_default_timezone_set('Pacific/Truk'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -74,7 +74,7 @@ print "wanted=Tuesday 00:00:00\n\n"; print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Pacific/Ponape"); +date_default_timezone_set('Pacific/Ponape'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); @@ -82,7 +82,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Monday 00:00:00\n\n"; print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes\n"; -putenv("TZ=America/Scoresbysund"); +date_default_timezone_set('America/Scoresbysund'); $tStamp = mktime (17, 17, 17, 1, 4099, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -90,7 +90,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Sunday 02:00:00\n\n"; print "TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes\n"; -putenv("TZ=America/Guyana"); +date_default_timezone_set('America/Guyana'); $tStamp = mktime (17, 17, 17, 1, 2031, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -98,7 +98,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Thursday 00:45:00\n\n"; print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n"; -putenv("TZ=Asia/Tehran"); +date_default_timezone_set('Asia/Tehran'); $tStamp = mktime (17, 17, 17, 1, 2855, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -107,7 +107,7 @@ print "wanted=Tuesday 00:30:00\n\n"; print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Pacific/Tarawa"); +date_default_timezone_set('Pacific/Tarawa'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); @@ -115,7 +115,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Monday 00:00:00\n\n"; print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n"; -putenv("TZ=Africa/Monrovia"); +date_default_timezone_set('Africa/Monrovia'); $tStamp = mktime (17, 17, 17, 1, 845, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); @@ -123,7 +123,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Monday 00:44:30\n\n"; print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n"; -putenv("TZ=Asia/Katmandu"); +date_default_timezone_set('Asia/Katmandu'); $tStamp = mktime (17, 17, 17, 1, 5838, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Wednesday", $tStamp); @@ -131,7 +131,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Wednesday 00:15:00\n\n"; print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n"; -putenv("TZ=Pacific/Nauru"); +date_default_timezone_set('Pacific/Nauru'); $tStamp = mktime (17, 17, 17, 1, 3401, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -139,7 +139,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Tuesday 00:30:00\n\n"; print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n"; -putenv("TZ=Pacific/Niue"); +date_default_timezone_set('Pacific/Niue'); $tStamp = mktime (17, 17, 17, 1, 3189, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Sunday", $tStamp); @@ -148,7 +148,7 @@ print "wanted=Sunday 00:30:00\n\n"; print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST or timezone transition.\n"; -putenv("TZ=Pacific/Port_Moresby"); +date_default_timezone_set('Pacific/Port_Moresby'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -156,7 +156,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Thursday 00:00:00\n\n"; print "TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes\n"; -putenv("TZ=America/Miquelon"); +date_default_timezone_set('America/Miquelon'); $tStamp = mktime (17, 17, 17, 1, 3767, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Thursday", $tStamp); @@ -165,7 +165,7 @@ print "wanted=Thursday 01:00:00\n\n"; print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or timezone transition.\n"; -putenv("TZ=Pacific/Palau"); +date_default_timezone_set('Pacific/Palau'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Saturday", $tStamp); @@ -174,7 +174,7 @@ print "wanted=Saturday 00:00:00\n\n"; print "TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Pacific/Funafuti"); +date_default_timezone_set('Pacific/Funafuti'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Wednesday", $tStamp); @@ -183,7 +183,7 @@ print "wanted=Wednesday 00:00:00\n\n"; print "TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Pacific/Wake"); +date_default_timezone_set('Pacific/Wake'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -192,7 +192,7 @@ print "wanted=Tuesday 00:00:00\n\n"; print "TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does not appear to have a DST or timezone transition.\n"; -putenv("TZ=Pacific/Wallis"); +date_default_timezone_set('Pacific/Wallis'); $tStamp = mktime (17, 17, 17, 1, 1, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Tuesday", $tStamp); @@ -200,7 +200,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n"; print "wanted=Tuesday 00:00:00\n\n"; print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes\n"; -putenv("TZ=America/Paramaribo"); +date_default_timezone_set('America/Paramaribo'); $tStamp = mktime (17, 17, 17, 1, 5381, 1970); print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n"; $strtotime_tstamp = strtotime("next Monday", $tStamp); diff --git a/ext/date/tests/bug33532.phpt b/ext/date/tests/bug33532.phpt index 286ceb4ce..148630855 100644 --- a/ext/date/tests/bug33532.phpt +++ b/ext/date/tests/bug33532.phpt @@ -3,6 +3,10 @@ Bug #33532 (Different output for strftime() and date()) --INI-- error_reporting=2047 date.timezone=UTC +--SKIPIF-- +<?php +if(PHP_OS == 'Darwin' || defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip strftime uses system TZ on Darwin and Windows"); +?> --FILE-- <?php @@ -18,6 +22,7 @@ print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n"; print "\nSetting TZ\n"; date_default_timezone_set('Australia/Sydney'); +putenv("TZ=Australia/Sydney"); $input = "10:00:00 AM July 1 2005"; print "input " . $input . "\n"; $tStamp = strtotime($input); diff --git a/ext/date/tests/bug48476.phpt b/ext/date/tests/bug48476.phpt new file mode 100644 index 000000000..2daa59487 --- /dev/null +++ b/ext/date/tests/bug48476.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #48476 (cloning extended DateTime class without calling parent::__constr crashed PHP) +--FILE-- +<?php +class MyDateTime extends DateTime { + public function __construct() { } +} +class MyDateTimeZone extends DateTimeZone { + public function __construct() { } +} + +$o = new MyDateTime; +var_dump($o->format("d")); +$x = clone $o; + +var_dump($x->format("d")); + +clone $o; + + +var_dump(timezone_location_get(clone new MyDateTimezone)); +?> +--EXPECTF-- +Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10 +bool(false) + +Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13 +bool(false) + +Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18 +bool(false) + + diff --git a/ext/date/tests/bug48678.phpt b/ext/date/tests/bug48678.phpt index 896693463..e2cb724f7 100644 --- a/ext/date/tests/bug48678.phpt +++ b/ext/date/tests/bug48678.phpt @@ -1,12 +1,12 @@ --TEST-- -Bug #48678 DateInterval segfaults when unserialising +Bug #48678 (DateInterval segfaults when unserialising) --FILE-- <?php -$x = new dateinterval("P3Y6M4DT12H30M5S"); +$x = new DateInterval("P3Y6M4DT12H30M5S"); print_r($x); $y = unserialize(serialize($x)); print_r($y); ---EXPECT-- +--EXPECTF-- DateInterval Object ( [y] => 3 @@ -16,7 +16,7 @@ DateInterval Object [i] => 30 [s] => 5 [invert] => 0 - [days] => + [days] =>%s ) DateInterval Object ( @@ -27,5 +27,5 @@ DateInterval Object [i] => 30 [s] => 5 [invert] => 0 - [days] => + [days] =>%s ) diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt index 4fa506ef5..9b1002317 100644 --- a/ext/date/tests/bug50392.phpt +++ b/ext/date/tests/bug50392.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #50392 date_create_from_format enforces 6 digits for 'u' format character +Bug #50392 (date_create_from_format enforces 6 digits for 'u' format character) --FILE-- <?php date_default_timezone_set('Europe/Bratislava'); diff --git a/ext/date/tests/bug51096.phpt b/ext/date/tests/bug51096.phpt index 31503bc7a..df31313a7 100644 --- a/ext/date/tests/bug51096.phpt +++ b/ext/date/tests/bug51096.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #51096: Test for "first day" vs "first day of". +Bug #51096 (Test for "first day" vs "first day of") --FILE-- <?php $tests = array( diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt new file mode 100644 index 000000000..8d765b02f --- /dev/null +++ b/ext/date/tests/bug51866.phpt @@ -0,0 +1,161 @@ +--TEST-- +Bug #51866 (Lenient parsing with parseFromFormat) +--FILE-- +<?php +date_default_timezone_set('UTC'); + +$tests = array( + array( 'Y-m-d', '2001-11-29 13:20:01' ), + array( 'Y-m-d+', '2001-11-29 13:20:01' ), + array( 'Y-m-d +', '2001-11-29 13:20:01' ), + array( 'Y-m-d+', '2001-11-29' ), + array( 'Y-m-d +', '2001-11-29' ), + array( 'Y-m-d +', '2001-11-29 ' ), +); +foreach( $tests as $test ) +{ + list($format, $str) = $test; + var_dump($format, $str); + $d = DateTime::createFromFormat($format, $str); + var_dump($d); + var_dump(DateTime::getLastErrors()); + + echo "\n\n"; +} +--EXPECTF-- +string(5) "Y-m-d" +string(19) "2001-11-29 13:20:01" +bool(false) +array(4) { + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(1) + ["errors"]=> + array(1) { + [10]=> + string(13) "Trailing data" + } +} + + +string(6) "Y-m-d+" +string(19) "2001-11-29 13:20:01" +object(DateTime)#2 (3) { + ["date"]=> + string(19) "2001-11-29 %d:%d:%d" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(%d) "%s" +} +array(4) { + ["warning_count"]=> + int(1) + ["warnings"]=> + array(1) { + [10]=> + string(13) "Trailing data" + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } +} + + +string(7) "Y-m-d +" +string(19) "2001-11-29 13:20:01" +object(DateTime)#3 (3) { + ["date"]=> + string(19) "2001-11-29 %d:%d:%d" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(%d) "%s" +} +array(4) { + ["warning_count"]=> + int(1) + ["warnings"]=> + array(1) { + [11]=> + string(13) "Trailing data" + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } +} + + +string(6) "Y-m-d+" +string(10) "2001-11-29" +object(DateTime)#2 (3) { + ["date"]=> + string(19) "2001-11-29 %d:%d:%d" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(%d) "%s" +} +array(4) { + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } +} + + +string(7) "Y-m-d +" +string(10) "2001-11-29" +bool(false) +array(4) { + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(1) + ["errors"]=> + array(1) { + [10]=> + string(12) "Data missing" + } +} + + +string(7) "Y-m-d +" +string(11) "2001-11-29 " +object(DateTime)#2 (3) { + ["date"]=> + string(19) "2001-11-29 %d:%d:%d" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(%d) "%s" +} +array(4) { + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } +} diff --git a/ext/date/tests/bug51994.phpt b/ext/date/tests/bug51994.phpt index fb0fe46d8..2c456ba6e 100644 --- a/ext/date/tests/bug51994.phpt +++ b/ext/date/tests/bug51994.phpt @@ -1,12 +1,9 @@ --TEST-- Bug #51994 (date_parse_from_format is parsing invalid date using 'yz' format) ---XFAIL-- -Bug #51994 isn't fixed yet --FILE-- <?php $trans_date = '10153'; // 152nd day of year 2010 -> 03.06.2010 $a_date = date_parse_from_format('yz', $trans_date); - var_dump($a_date); ?> --EXPECTF-- diff --git a/ext/date/tests/bug52062-64bit.phpt b/ext/date/tests/bug52062-64bit.phpt new file mode 100644 index 000000000..e4a2a524f --- /dev/null +++ b/ext/date/tests/bug52062-64bit.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (64 bit) +--SKIPIF-- +<?php +if (PHP_INT_SIZE == 4) die('skip 64 bit only'); +?> +--INI-- +date.timezone=UTC +--FILE-- +<?php +$d = new DateTime('@100000000000'); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$d->setTimestamp(100000000000); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$i = new DateInterval('PT100000000000S'); +var_dump($i->format('%s')); +?> +--EXPECT-- +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(12) "100000000000" diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt new file mode 100644 index 000000000..d3e1c9abf --- /dev/null +++ b/ext/date/tests/bug52062.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimestamp) (32 bit) +--SKIPIF-- +<?php +if (PHP_INT_SIZE == 8) die('skip 32-bit only'); +?> +--INI-- +date.timezone=UTC +--FILE-- +<?php +$d = new DateTime('@100000000000'); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$d->setTimestamp(100000000000); +var_dump($d->format('Y-m-d H:i:s U')); +var_dump($d->getTimestamp()); + +$i = new DateInterval('PT100000000000S'); +var_dump($i->format('%s')); +?> +--EXPECT-- +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(32) "5138-11-16 09:46:40 100000000000" +int(100000000000) +string(12) "100000000000" diff --git a/ext/date/tests/bug52113.phpt b/ext/date/tests/bug52113.phpt new file mode 100644 index 000000000..a7d9339d1 --- /dev/null +++ b/ext/date/tests/bug52113.phpt @@ -0,0 +1,102 @@ +--TEST-- +Bug #52113 (Seg fault while creating (by unserialization) DatePeriod) +--INI-- +date.timezone=UTC +--FILE-- +<?php +$start = new DateTime('2003-01-02 08:00:00'); +$end = new DateTime('2003-01-02 12:00:00'); +$diff = $start->diff($end); +$p = new DatePeriod($start, $diff, 2); +$diff_s = serialize($diff); +var_dump($diff, $diff_s); +var_export($diff); + +$diff_un = unserialize($diff_s); +$p = new DatePeriod($start, $diff_un, 2); +var_dump($diff_un, $p); + +$unser = DateInterval::__set_state(array( + 'y' => 7, + 'm' => 6, + 'd' => 5, + 'h' => 4, + 'i' => 3, + 's' => 2, + 'invert' => 1, + 'days' => 2400, +)); + +$p = new DatePeriod($start, $diff_un, 2); +var_dump($unser, $p); + +?> +--EXPECT-- +object(DateInterval)#3 (8) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(4) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + int(0) +} +string(128) "O:12:"DateInterval":8:{s:1:"y";i:0;s:1:"m";i:0;s:1:"d";i:0;s:1:"h";i:4;s:1:"i";i:0;s:1:"s";i:0;s:6:"invert";i:0;s:4:"days";i:0;}" +DateInterval::__set_state(array( + 'y' => 0, + 'm' => 0, + 'd' => 0, + 'h' => 4, + 'i' => 0, + 's' => 0, + 'invert' => 0, + 'days' => 0, +))object(DateInterval)#5 (8) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(4) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + int(0) +} +object(DatePeriod)#6 (0) { +} +object(DateInterval)#4 (8) { + ["y"]=> + int(7) + ["m"]=> + int(6) + ["d"]=> + int(5) + ["h"]=> + int(4) + ["i"]=> + int(3) + ["s"]=> + int(2) + ["invert"]=> + int(1) + ["days"]=> + int(2400) +} +object(DatePeriod)#7 (0) { +} diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt new file mode 100644 index 000000000..f08986653 --- /dev/null +++ b/ext/date/tests/bug53437.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #53437 (Crash when using unserialized DatePeriod instance) +--XFAIL-- +Bug #53437 Not fixed yet +--FILE-- +<?php +$dp = new DatePeriod(new DateTime('2010-01-01 UTC'), new DateInterval('P1D'), 2); + +echo "Original:\r\n"; +foreach($dp as $dt) { + echo $dt->format('Y-m-d H:i:s')."\r\n"; +} +echo "\r\n"; +var_dump($dp); + +$ser = serialize($dp); // $ser is: O:10:"DatePeriod":0:{} + +// Create dangerous instance +$dpu = unserialize($ser); // $dpu has invalid values??? +var_dump($dpu); + +echo "Unserialized:\r\n"; +// ???which leads to CRASH: +foreach($dpu as $dt) { + echo $dt->format('Y-m-d H:i:s')."\r\n"; +} +?> +--EXPECT-- diff --git a/ext/date/tests/bug53502.phpt b/ext/date/tests/bug53502.phpt new file mode 100644 index 000000000..6cfa5e07f --- /dev/null +++ b/ext/date/tests/bug53502.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #53502 (strtotime with timezone memory leak) +--INI-- +date.timezone=UTC +--FILE-- +<?php +for ($i = 0; $i < 1000; $i++) { + strtotime('Monday 00:00 Europe/Paris'); // Memory leak +} +echo "Nothing, test only makes sense through valgrind.\n"; +?> +--EXPECT-- +Nothing, test only makes sense through valgrind. diff --git a/ext/date/tests/bug54597.phpt b/ext/date/tests/bug54597.phpt new file mode 100644 index 000000000..d196adf12 --- /dev/null +++ b/ext/date/tests/bug54597.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #54597 (incorrect years for DateTime objects created with 4-digit years) +--INI-- +date.timezone=Europe/London +--FILE-- +<?php +$tz = new DateTimeZone("Europe/Amsterdam"); +$dateObject = new DateTime( 'January 0099', $tz ); +echo $dateObject->format( 'Y' ), "\n"; +$dateObject = new DateTime( 'January 1, 0099', $tz ); +echo $dateObject->format( 'Y' ), "\n"; +$dateObject = new DateTime( '0099-01', $tz ); +echo $dateObject->format( 'Y' ), "\n"; +?> +--EXPECT-- +0099 +0099 +0099 diff --git a/ext/date/tests/bug54851.phpt b/ext/date/tests/bug54851.phpt new file mode 100644 index 000000000..84d18ba5a --- /dev/null +++ b/ext/date/tests/bug54851.phpt @@ -0,0 +1,57 @@ +--TEST-- +Bug #54851 (DateTime::createFromFormat() doesn't interpret "D") +--INI-- +date.timezone=UTC +--FILE-- +<?php +$date = new DateTime("2011-05-17T22:14:12"); +$date2 = DateTime::createFromFormat("D H i s", $date->format("D"). ' 0 00 00'); +echo $date->format("r"), "\n"; +echo $date2->format("r"), "\n"; +var_dump($date->format("D") == $date2->format("D")); + +// Verify that our implementation works regardless of position +$datePre = DateTime::createFromFormat("!D d M Y", "Fri 17 may 2011"); +$datePost = DateTime::createFromFormat("!d M Y D", "17 may 2011 Fri"); +echo $datePre->format("r"), "\n"; +echo $datePost->format("r"), "\n"; +var_dump($datePre->format("Y-m-d") == $datePost->format("Y-m-d")); + +// Verify that our implementation is the same as for the constructor and +// strtotime +$date1 = new DateTime("Tuesday"); +$date2 = DateTime::createFromFormat("D H i s", "Tuesday 0 00 00"); +echo $date1->format('r'), "\n"; +echo $date2->format('r'), "\n"; +var_dump($date1->format('D') == $date2->format('D')); + +// - when the day is not the same as the day on the original date: +$date1 = DateTime::createFromFormat("!D d M Y", "Fri 19 November 2011"); +$date2 = new DateTime("Fri 19 November 2011"); +echo $date1->format('r'), "\n"; +echo $date2->format('r'), "\n"; +var_dump($date1->format('Y-m-d') == $date2->format('Y-m-d')); + +// - when the day *is* the same as the day on the original date: +$date1 = DateTime::createFromFormat("!D d M Y", "Sat 19 November 2011"); +$date2 = new DateTime("Sat 19 November 2011"); +echo $date1->format('r'), "\n"; +echo $date2->format('r'), "\n"; +var_dump($date1->format('Y-m-d') == $date2->format('Y-m-d')); +?> +--EXPECTF-- +Tue, 17 May 2011 22:14:12 +0000 +Tue, %d %s %d 00:00:00 +0000 +bool(true) +Fri, 20 May 2011 00:00:00 +0000 +Fri, 20 May 2011 00:00:00 +0000 +bool(true) +Tue, %d %s %d 00:00:00 +0000 +Tue, %d %s %d 00:00:00 +0000 +bool(true) +Fri, 25 Nov 2011 00:00:00 +0000 +Fri, 25 Nov 2011 00:00:00 +0000 +bool(true) +Sat, 19 Nov 2011 00:00:00 +0000 +Sat, 19 Nov 2011 00:00:00 +0000 +bool(true) diff --git a/ext/date/tests/bug55253.phpt b/ext/date/tests/bug55253.phpt index 3c0efc469..5751cc112 100755 --- a/ext/date/tests/bug55253.phpt +++ b/ext/date/tests/bug55253.phpt @@ -1,9 +1,7 @@ --TEST-- -DateTime::add() and sub() result -1 hour on objects with time zone type 2 +Bug #55253 (DateTime::add() and sub() result -1 hour on objects with time zone type 2) --CREDITS-- Daniel Convissor <danielc@php.net> ---XFAIL-- -Bug 55253 exists --FILE-- <?php diff --git a/ext/date/tests/bug60236.phpt b/ext/date/tests/bug60236.phpt new file mode 100644 index 000000000..faa0e160c --- /dev/null +++ b/ext/date/tests/bug60236.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #60236 (TLA timezone dates are not converted properly from timestamp) +--INI-- +date.timezone=America/New_York +--FILE-- +<?php +$t = new DateTime('2010-07-06 18:38:28 EDT'); +$ts = $t->format('U'); +var_dump($ts); +$t->setTimestamp($ts); +var_dump($t); +?> +--EXPECT-- +string(10) "1278455908" +object(DateTime)#1 (3) { + ["date"]=> + string(19) "2010-07-06 18:38:28" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "EDT" +} diff --git a/ext/date/tests/date.phpt b/ext/date/tests/date.phpt index ccdb3cda9..12bc9f0fc 100644 --- a/ext/date/tests/date.phpt +++ b/ext/date/tests/date.phpt @@ -3,13 +3,13 @@ date() function --FILE-- <?php $tmp = "cr"; -putenv ("TZ=GMT0"); +date_default_timezone_set('UTC'); for($a = 0;$a < strlen($tmp); $a++){ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; } -putenv ("TZ=MET"); +date_default_timezone_set("MET"); for($a = 0;$a < strlen($tmp); $a++){ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt index c6a6daf7a..bca8789e7 100644 --- a/ext/date/tests/date_default_timezone_set-1.phpt +++ b/ext/date/tests/date_default_timezone_set-1.phpt @@ -1,5 +1,9 @@ --TEST-- date_default_timezone_set() function [1] +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die('skip diff TZ detection on windows.'); +?> --INI-- date.timezone= --FILE-- diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt index 198941871..d9abdce17 100644 --- a/ext/date/tests/gmstrftime_variation22.phpt +++ b/ext/date/tests/gmstrftime_variation22.phpt @@ -5,8 +5,8 @@ Test gmstrftime() function : usage variation - Checking Preferred date and time if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { die("skip Test is not valid for Windows"); } -if (!setlocale(LC_ALL, "en_US.utf8", "en_US")) { - die("skip Locale en_US or en_US.utf8 is required to run this test"); +if (!setlocale(LC_TIME, "POSIX")) { + die("skip Locale POSIX is required to run this test"); } ?> --FILE-- @@ -21,7 +21,8 @@ echo "*** Testing gmstrftime() : usage variation ***\n"; // Initialise function arguments not being substituted (if any) $timestamp = gmmktime(8, 8, 8, 8, 8, 2008); -setlocale(LC_ALL, "en_US.utf8", "en_US"); +setlocale(LC_TIME, "POSIX"); +putenv("LC_TIME=POSIX"); date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over @@ -46,13 +47,13 @@ foreach($inputs as $key =>$value) { --Preferred date and time representation-- string(2) "%c" -string(31) "Fri 08 Aug 2008 08:08:08 AM GMT" +string(24) "Fri Aug 8 08:08:08 2008" --Preferred date representation-- string(2) "%x" -string(10) "08/08/2008" +string(8) "08/08/08" --Preferred time representation-- string(2) "%X" -string(11) "08:08:08 AM" +string(8) "08:08:08" ===DONE=== diff --git a/ext/date/tests/mktime-2.phpt b/ext/date/tests/mktime-2.phpt index aa259b577..931f63755 100644 --- a/ext/date/tests/mktime-2.phpt +++ b/ext/date/tests/mktime-2.phpt @@ -5,13 +5,13 @@ error_reporting=2047 --FILE-- <?php $timezones = array( - 'GMT0', + 'UTC', 'Europe/London' ); foreach($timezones as $timezone) { - putenv('TZ='.$timezone); + date_default_timezone_set($timezone); /* status of daylight saving time unknown */ var_dump(mktime(0, 0, 0, 1, 1, 2002)); diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt new file mode 100644 index 000000000..c29760891 --- /dev/null +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt @@ -0,0 +1,380 @@ +--TEST-- +RFC: DateTime and Daylight Saving Time Transitions (zone type 1) +--CREDITS-- +Daniel Convissor <danielc@php.net> +--FILE-- +<?php + +date_default_timezone_set('America/New_York'); +$date_format = 'Y-m-d H:i:s e'; +$interval_format = 'P%dDT%hH'; + +/* + * Forward Transitions, diff(). + */ + +$end = new DateTime('2010-03-14 03:00:00 -0400'); +$start = new DateTime('2010-03-14 01:59:59 -0500'); +echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + +$end = new DateTime('2010-03-14 04:30:00 -0400'); +$start = new DateTime('2010-03-13 04:30:00 -0500'); +echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 -0400'); +$start = new DateTime('2010-03-13 04:30:00 -0500'); +echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 -0500'); +$start = new DateTime('2010-03-13 04:30:00 -0500'); +echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 -0500'); +$start = new DateTime('2010-03-13 01:30:00 -0500'); +echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 -0400'); +$start = new DateTime('2010-03-13 03:30:00 -0500'); +echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 -0400'); +$start = new DateTime('2010-03-13 02:30:00 -0500'); +echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +echo "\n"; + +/* + * Forward Transitions, add(). + */ + +$start = new DateTime('2010-03-14 01:59:59 -0500'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00 -0500'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00 -0500'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 01:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 02:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Forward Transitions, sub(). + */ + +$end = new DateTime('2010-03-14 03:00:00 -0400'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 04:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 -0400'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 -0500'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-15 03:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-15 02:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, diff(). + */ + +$end = new DateTime('2010-11-07 01:00:00 -0500'); +$start = new DateTime('2010-11-07 01:59:59 -0400'); +echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + +$end = new DateTime('2010-11-07 04:30:00 -0500'); +$start = new DateTime('2010-11-06 04:30:00 -0400'); +echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00 -0500'); +$start = new DateTime('2010-11-06 04:30:00 -0400'); +echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00 -0500'); +$start = new DateTime('2010-11-06 04:30:00 -0400'); +echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0500'); +$start = new DateTime('2010-11-06 04:30:00 -0400'); +echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0400'); +$start = new DateTime('2010-11-06 04:30:00 -0400'); +echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0400'); +$start = new DateTime('2010-11-06 01:30:00 -0400'); +echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0500'); +$start = new DateTime('2010-11-06 01:30:00 -0400'); +echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, add(). + */ + +$start = new DateTime('2010-11-07 01:59:59 -0400'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 -0400'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 -0400'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 -0400'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 -0400'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 01:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 01:30:00 -0400'); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 -0400'); +$interval_spec = 'PT25H'; +$interval = new DateInterval($interval_spec); +echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 03:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 02:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, sub(). + */ + +$end = new DateTime('2010-11-07 01:00:00 -0500'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 04:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00 -0500'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00 -0500'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0500'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0400'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0400'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 -0500'); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00 -0500'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +?> +--EXPECT-- +fd1 2010-03-14 03:00:00 -04:00 - 2010-03-14 01:59:59 -05:00 = PT0H0M1S +fd2 2010-03-14 04:30:00 -04:00 - 2010-03-13 04:30:00 -05:00 = P0DT23H +fd3 2010-03-14 03:30:00 -04:00 - 2010-03-13 04:30:00 -05:00 = P0DT22H +fd4 2010-03-14 01:30:00 -05:00 - 2010-03-13 04:30:00 -05:00 = P0DT21H +fd5 2010-03-14 01:30:00 -05:00 - 2010-03-13 01:30:00 -05:00 = P1DT0H +fd6 2010-03-14 03:30:00 -04:00 - 2010-03-13 03:30:00 -05:00 = P0DT23H +fd7 2010-03-14 03:30:00 -04:00 - 2010-03-13 02:30:00 -05:00 = P1DT0H + +fa1 2010-03-14 01:59:59 -05:00 + PT1S = 2010-03-14 02:00:00 -05:00 +fa2 2010-03-13 04:30:00 -05:00 + P1D = 2010-03-14 04:30:00 -05:00 +fa3 2010-03-13 04:30:00 -05:00 + PT22H = 2010-03-14 02:30:00 -05:00 +fa4 2010-03-13 04:30:00 -05:00 + PT21H = 2010-03-14 01:30:00 -05:00 +fa5 2010-03-13 01:30:00 -05:00 + P1D = 2010-03-14 01:30:00 -05:00 +fa6 2010-03-13 02:30:00 -05:00 + P1D = 2010-03-14 02:30:00 -05:00 + +fs1 2010-03-14 03:00:00 -04:00 - PT1S = 2010-03-14 02:59:59 -04:00 +fs2 2010-03-14 04:30:00 -04:00 - P1D = 2010-03-13 04:30:00 -04:00 +fs3 2010-03-14 03:30:00 -04:00 - PT22H = 2010-03-13 05:30:00 -04:00 +fs4 2010-03-14 01:30:00 -05:00 - PT21H = 2010-03-13 04:30:00 -05:00 +fs5 2010-03-14 01:30:00 -05:00 - P1D = 2010-03-13 01:30:00 -05:00 +fs6 2010-03-15 03:30:00 -04:00 - P1D = 2010-03-14 03:30:00 -04:00 +fs7 2010-03-15 02:30:00 -04:00 - P1D = 2010-03-14 02:30:00 -04:00 + +bd1 2010-11-07 01:00:00 -05:00 - 2010-11-07 01:59:59 -04:00 = PT0H0M1S +bd2 2010-11-07 04:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P1DT1H +bd3 2010-11-07 03:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P1DT0H +bd4 2010-11-07 02:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P0DT23H +bd5 2010-11-07 01:30:00 -05:00 - 2010-11-06 04:30:00 -04:00 = P0DT22H +bd6 2010-11-07 01:30:00 -04:00 - 2010-11-06 04:30:00 -04:00 = P0DT21H +bd7 2010-11-07 01:30:00 -04:00 - 2010-11-06 01:30:00 -04:00 = P1DT0H +bd8 2010-11-07 01:30:00 -05:00 - 2010-11-06 01:30:00 -04:00 = P1DT1H + +ba1 2010-11-07 01:59:59 -04:00 + PT1S = 2010-11-07 02:00:00 -04:00 +ba2 2010-11-06 04:30:00 -04:00 + P1D = 2010-11-07 04:30:00 -04:00 +ba3 2010-11-06 04:30:00 -04:00 + PT24H = 2010-11-07 04:30:00 -04:00 +ba4 2010-11-06 04:30:00 -04:00 + PT23H = 2010-11-07 03:30:00 -04:00 +ba5 2010-11-06 04:30:00 -04:00 + PT22H = 2010-11-07 02:30:00 -04:00 +ba6 2010-11-06 04:30:00 -04:00 + PT21H = 2010-11-07 01:30:00 -04:00 +ba7 2010-11-06 01:30:00 -04:00 + P1D = 2010-11-07 01:30:00 -04:00 +ba8 2010-11-06 01:30:00 -04:00 + P1DT1H = 2010-11-07 02:30:00 -04:00 +ba9 2010-11-06 04:30:00 -04:00 + PT25H = 2010-11-07 05:30:00 -04:00 +ba10 2010-11-06 03:30:00 -04:00 + P1D = 2010-11-07 03:30:00 -04:00 +ba11 2010-11-06 02:30:00 -04:00 + P1D = 2010-11-07 02:30:00 -04:00 + +bs1 2010-11-07 01:00:00 -05:00 - PT1S = 2010-11-07 00:59:59 -05:00 +bs2 2010-11-07 04:30:00 -05:00 - P1D = 2010-11-06 04:30:00 -05:00 +bs3 2010-11-07 03:30:00 -05:00 - PT24H = 2010-11-06 03:30:00 -05:00 +bs4 2010-11-07 02:30:00 -05:00 - PT23H = 2010-11-06 03:30:00 -05:00 +bs5 2010-11-07 01:30:00 -05:00 - PT22H = 2010-11-06 03:30:00 -05:00 +bs6 2010-11-07 01:30:00 -04:00 - PT21H = 2010-11-06 04:30:00 -04:00 +bs7 2010-11-07 01:30:00 -04:00 - P1D = 2010-11-06 01:30:00 -04:00 +bs8 2010-11-07 01:30:00 -05:00 - P1DT1H = 2010-11-06 00:30:00 -05:00 +bs9 2010-11-07 03:30:00 -05:00 - P1D = 2010-11-06 03:30:00 -05:00 +bs10 2010-11-07 02:30:00 -05:00 - P1D = 2010-11-06 02:30:00 -05:00 diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt new file mode 100644 index 000000000..72585125e --- /dev/null +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt @@ -0,0 +1,380 @@ +--TEST-- +RFC: DateTime and Daylight Saving Time Transitions (zone type 2) +--CREDITS-- +Daniel Convissor <danielc@php.net> +--FILE-- +<?php + +date_default_timezone_set('America/New_York'); +$date_format = 'Y-m-d H:i:s T e'; +$interval_format = 'P%dDT%hH'; + +/* + * Forward Transitions, diff(). + */ + +$end = new DateTime('2010-03-14 03:00:00 EDT'); +$start = new DateTime('2010-03-14 01:59:59 EST'); +echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + +$end = new DateTime('2010-03-14 04:30:00 EDT'); +$start = new DateTime('2010-03-13 04:30:00 EST'); +echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 EDT'); +$start = new DateTime('2010-03-13 04:30:00 EST'); +echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 EST'); +$start = new DateTime('2010-03-13 04:30:00 EST'); +echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 EST'); +$start = new DateTime('2010-03-13 01:30:00 EST'); +echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 EDT'); +$start = new DateTime('2010-03-13 03:30:00 EST'); +echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 EDT'); +$start = new DateTime('2010-03-13 02:30:00 EST'); +echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +echo "\n"; + +/* + * Forward Transitions, add(). + */ + +$start = new DateTime('2010-03-14 01:59:59 EST'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00 EST'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00 EST'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 01:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 02:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Forward Transitions, sub(). + */ + +$end = new DateTime('2010-03-14 03:00:00 EDT'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 04:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00 EDT'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 EST'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-15 03:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-15 02:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, diff(). + */ + +$end = new DateTime('2010-11-07 01:00:00 EST'); +$start = new DateTime('2010-11-07 01:59:59 EDT'); +echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + +$end = new DateTime('2010-11-07 04:30:00 EST'); +$start = new DateTime('2010-11-06 04:30:00 EDT'); +echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00 EST'); +$start = new DateTime('2010-11-06 04:30:00 EDT'); +echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00 EST'); +$start = new DateTime('2010-11-06 04:30:00 EDT'); +echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$start = new DateTime('2010-11-06 04:30:00 EDT'); +echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EDT'); +$start = new DateTime('2010-11-06 04:30:00 EDT'); +echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EDT'); +$start = new DateTime('2010-11-06 01:30:00 EDT'); +echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$start = new DateTime('2010-11-06 01:30:00 EDT'); +echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, add(). + */ + +$start = new DateTime('2010-11-07 01:59:59 EDT'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 EDT'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 EDT'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 EDT'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 EDT'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 01:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 01:30:00 EDT'); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00 EDT'); +$interval_spec = 'PT25H'; +$interval = new DateInterval($interval_spec); +echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 03:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 02:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, sub(). + */ + +$end = new DateTime('2010-11-07 01:00:00 EST'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 04:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00 EST'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00 EST'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EDT'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EDT'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00 EST'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +?> +--EXPECT-- +fd1 2010-03-14 03:00:00 EDT EDT - 2010-03-14 01:59:59 EST EST = PT0H0M1S +fd2 2010-03-14 04:30:00 EDT EDT - 2010-03-13 04:30:00 EST EST = P0DT23H +fd3 2010-03-14 03:30:00 EDT EDT - 2010-03-13 04:30:00 EST EST = P0DT22H +fd4 2010-03-14 01:30:00 EST EST - 2010-03-13 04:30:00 EST EST = P0DT21H +fd5 2010-03-14 01:30:00 EST EST - 2010-03-13 01:30:00 EST EST = P1DT0H +fd6 2010-03-14 03:30:00 EDT EDT - 2010-03-13 03:30:00 EST EST = P0DT23H +fd7 2010-03-14 03:30:00 EDT EDT - 2010-03-13 02:30:00 EST EST = P1DT0H + +fa1 2010-03-14 01:59:59 EST EST + PT1S = 2010-03-14 02:00:00 EST EST +fa2 2010-03-13 04:30:00 EST EST + P1D = 2010-03-14 04:30:00 EST EST +fa3 2010-03-13 04:30:00 EST EST + PT22H = 2010-03-14 02:30:00 EST EST +fa4 2010-03-13 04:30:00 EST EST + PT21H = 2010-03-14 01:30:00 EST EST +fa5 2010-03-13 01:30:00 EST EST + P1D = 2010-03-14 01:30:00 EST EST +fa6 2010-03-13 02:30:00 EST EST + P1D = 2010-03-14 02:30:00 EST EST + +fs1 2010-03-14 03:00:00 EDT EDT - PT1S = 2010-03-14 02:59:59 EDT EDT +fs2 2010-03-14 04:30:00 EDT EDT - P1D = 2010-03-13 04:30:00 EDT EDT +fs3 2010-03-14 03:30:00 EDT EDT - PT22H = 2010-03-13 05:30:00 EDT EDT +fs4 2010-03-14 01:30:00 EST EST - PT21H = 2010-03-13 04:30:00 EST EST +fs5 2010-03-14 01:30:00 EST EST - P1D = 2010-03-13 01:30:00 EST EST +fs6 2010-03-15 03:30:00 EDT EDT - P1D = 2010-03-14 03:30:00 EDT EDT +fs7 2010-03-15 02:30:00 EDT EDT - P1D = 2010-03-14 02:30:00 EDT EDT + +bd1 2010-11-07 01:00:00 EST EST - 2010-11-07 01:59:59 EDT EDT = PT0H0M1S +bd2 2010-11-07 04:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P1DT1H +bd3 2010-11-07 03:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P1DT0H +bd4 2010-11-07 02:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P0DT23H +bd5 2010-11-07 01:30:00 EST EST - 2010-11-06 04:30:00 EDT EDT = P0DT22H +bd6 2010-11-07 01:30:00 EDT EDT - 2010-11-06 04:30:00 EDT EDT = P0DT21H +bd7 2010-11-07 01:30:00 EDT EDT - 2010-11-06 01:30:00 EDT EDT = P1DT0H +bd8 2010-11-07 01:30:00 EST EST - 2010-11-06 01:30:00 EDT EDT = P1DT1H + +ba1 2010-11-07 01:59:59 EDT EDT + PT1S = 2010-11-07 02:00:00 EDT EDT +ba2 2010-11-06 04:30:00 EDT EDT + P1D = 2010-11-07 04:30:00 EDT EDT +ba3 2010-11-06 04:30:00 EDT EDT + PT24H = 2010-11-07 04:30:00 EDT EDT +ba4 2010-11-06 04:30:00 EDT EDT + PT23H = 2010-11-07 03:30:00 EDT EDT +ba5 2010-11-06 04:30:00 EDT EDT + PT22H = 2010-11-07 02:30:00 EDT EDT +ba6 2010-11-06 04:30:00 EDT EDT + PT21H = 2010-11-07 01:30:00 EDT EDT +ba7 2010-11-06 01:30:00 EDT EDT + P1D = 2010-11-07 01:30:00 EDT EDT +ba8 2010-11-06 01:30:00 EDT EDT + P1DT1H = 2010-11-07 02:30:00 EDT EDT +ba9 2010-11-06 04:30:00 EDT EDT + PT25H = 2010-11-07 05:30:00 EDT EDT +ba10 2010-11-06 03:30:00 EDT EDT + P1D = 2010-11-07 03:30:00 EDT EDT +ba11 2010-11-06 02:30:00 EDT EDT + P1D = 2010-11-07 02:30:00 EDT EDT + +bs1 2010-11-07 01:00:00 EST EST - PT1S = 2010-11-07 00:59:59 EST EST +bs2 2010-11-07 04:30:00 EST EST - P1D = 2010-11-06 04:30:00 EST EST +bs3 2010-11-07 03:30:00 EST EST - PT24H = 2010-11-06 03:30:00 EST EST +bs4 2010-11-07 02:30:00 EST EST - PT23H = 2010-11-06 03:30:00 EST EST +bs5 2010-11-07 01:30:00 EST EST - PT22H = 2010-11-06 03:30:00 EST EST +bs6 2010-11-07 01:30:00 EDT EDT - PT21H = 2010-11-06 04:30:00 EDT EDT +bs7 2010-11-07 01:30:00 EDT EDT - P1D = 2010-11-06 01:30:00 EDT EDT +bs8 2010-11-07 01:30:00 EST EST - P1DT1H = 2010-11-06 00:30:00 EST EST +bs9 2010-11-07 03:30:00 EST EST - P1D = 2010-11-06 03:30:00 EST EST +bs10 2010-11-07 02:30:00 EST EST - P1D = 2010-11-06 02:30:00 EST EST diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt new file mode 100644 index 000000000..855fe4ef6 --- /dev/null +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt @@ -0,0 +1,399 @@ +--TEST-- +RFC: DateTime and Daylight Saving Time Transitions (zone type 3) +--CREDITS-- +Daniel Convissor <danielc@php.net> +--XFAIL-- +RFC not implemented yet +--FILE-- +<?php + +date_default_timezone_set('America/New_York'); +$date_format = 'Y-m-d H:i:s T e'; +$interval_format = 'P%dDT%hH'; + +/* + * Forward Transitions, diff(). + */ + +$end = new DateTime('2010-03-14 03:00:00'); +$start = new DateTime('2010-03-14 01:59:59'); +echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + +$end = new DateTime('2010-03-14 04:30:00'); +$start = new DateTime('2010-03-13 04:30:00'); +echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00'); +$start = new DateTime('2010-03-13 04:30:00'); +echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00'); +$start = new DateTime('2010-03-13 04:30:00'); +echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00'); +$start = new DateTime('2010-03-13 01:30:00'); +echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00'); +$start = new DateTime('2010-03-13 03:30:00'); +echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00'); +$start = new DateTime('2010-03-13 02:30:00'); +echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +echo "\n"; + +/* + * Forward Transitions, add(). + */ + +$start = new DateTime('2010-03-14 01:59:59'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 04:30:00'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 01:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-03-13 02:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Forward Transitions, sub(). + */ + +$end = new DateTime('2010-03-14 03:00:00'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 04:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 03:30:00'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-14 01:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-15 03:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-03-15 02:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +echo "\n"; + + +/* + * For backward transitions, must create objects with zone type 2 + * where specifying Daylight or Standard time is required + * then converting them to zone type 3. + */ + +$tz = new DateTimeZone('America/New_York'); + +/* + * Backward Transitions, diff(). + */ + +$end = new DateTime('2010-11-07 01:00:00 EST'); +$end->setTimeZone($tz); +$start = new DateTime('2010-11-07 01:59:59'); +echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + +$end = new DateTime('2010-11-07 04:30:00'); +$start = new DateTime('2010-11-06 04:30:00'); +echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00'); +$start = new DateTime('2010-11-06 04:30:00'); +echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00'); +$start = new DateTime('2010-11-06 04:30:00'); +echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$end->setTimeZone($tz); +$start = new DateTime('2010-11-06 04:30:00'); +echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EDT'); +$end->setTimeZone($tz); +$start = new DateTime('2010-11-06 04:30:00'); +echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00'); +$start = new DateTime('2010-11-06 01:30:00'); +echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$end->setTimeZone($tz); +$start = new DateTime('2010-11-06 01:30:00'); +echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, add(). + */ + +$start = new DateTime('2010-11-07 01:59:59'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 01:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 01:30:00'); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT25H'; +$interval = new DateInterval($interval_spec); +echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 03:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +$start = new DateTime('2010-11-06 02:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " + . $start->add($interval)->format($date_format) . "\n"; + +echo "\n"; + +/* + * Backward Transitions, sub(). + */ + +$end = new DateTime('2010-11-07 01:00:00 EST'); +$end->setTimeZone($tz); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 04:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$end->setTimeZone($tz); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EDT'); +$end->setTimeZone($tz); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 01:30:00 EST'); +$end->setTimeZone($tz); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 03:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +$end = new DateTime('2010-11-07 02:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " + . $end->sub($interval)->format($date_format) . "\n"; + +?> +--EXPECT-- +fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S +fd2 2010-03-14 04:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P1DT0H +fd3 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT22H +fd4 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT21H +fd5 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 01:30:00 EST America/New_York = P1DT0H +fd6 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 03:30:00 EST America/New_York = P1DT0H +fd7 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 02:30:00 EST America/New_York = P1DT1H + +fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York +fa2 2010-03-13 04:30:00 EST America/New_York + P1D = 2010-03-14 04:30:00 EDT America/New_York +fa3 2010-03-13 04:30:00 EST America/New_York + PT22H = 2010-03-14 03:30:00 EDT America/New_York +fa4 2010-03-13 04:30:00 EST America/New_York + PT21H = 2010-03-14 01:30:00 EST America/New_York +fa5 2010-03-13 01:30:00 EST America/New_York + P1D = 2010-03-14 01:30:00 EST America/New_York +fa6 2010-03-13 02:30:00 EST America/New_York + P1D = 2010-03-14 03:30:00 EDT America/New_York + +fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York +fs2 2010-03-14 04:30:00 EDT America/New_York - P1D = 2010-03-13 04:30:00 EST America/New_York +fs3 2010-03-14 03:30:00 EDT America/New_York - PT22H = 2010-03-13 04:30:00 EST America/New_York +fs4 2010-03-14 01:30:00 EST America/New_York - PT21H = 2010-03-13 04:30:00 EST America/New_York +fs5 2010-03-14 01:30:00 EST America/New_York - P1D = 2010-03-13 01:30:00 EST America/New_York +fs6 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York +fs7 2010-03-15 03:30:00 EDT America/New_York - P1D = 2010-03-14 03:30:00 EDT America/New_York + +bd1 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = PT0H0M1S +bd2 2010-11-07 04:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT0H +bd3 2010-11-07 03:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT24H +bd4 2010-11-07 02:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT23H +bd5 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT22H +bd6 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT21H +bd7 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT0H +bd8 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT1H + +ba1 2010-11-07 01:59:59 EDT America/New_York + PT1S = 2010-11-07 01:00:00 EST America/New_York +ba2 2010-11-06 04:30:00 EDT America/New_York + P1D = 2010-11-07 04:30:00 EST America/New_York +ba3 2010-11-06 04:30:00 EDT America/New_York + PT24H = 2010-11-07 03:30:00 EST America/New_York +ba4 2010-11-06 04:30:00 EDT America/New_York + PT23H = 2010-11-07 02:30:00 EST America/New_York +ba5 2010-11-06 04:30:00 EDT America/New_York + PT22H = 2010-11-07 01:30:00 EST America/New_York +ba6 2010-11-06 04:30:00 EDT America/New_York + PT21H = 2010-11-07 01:30:00 EDT America/New_York +ba7 2010-11-06 01:30:00 EDT America/New_York + P1D = 2010-11-07 01:30:00 EDT America/New_York +ba8 2010-11-06 01:30:00 EDT America/New_York + P1DT1H = 2010-11-07 01:30:00 EST America/New_York +ba9 2010-11-06 04:30:00 EDT America/New_York + PT25H = 2010-11-07 04:30:00 EST America/New_York +ba10 2010-11-06 03:30:00 EDT America/New_York + P1D = 2010-11-07 03:30:00 EST America/New_York +ba11 2010-11-06 02:30:00 EDT America/New_York + P1D = 2010-11-07 02:30:00 EST America/New_York + +bs1 2010-11-07 01:00:00 EST America/New_York - PT1S = 2010-11-07 01:59:59 EDT America/New_York +bs2 2010-11-07 04:30:00 EST America/New_York - P1D = 2010-11-06 04:30:00 EDT America/New_York +bs3 2010-11-07 03:30:00 EST America/New_York - PT24H = 2010-11-06 04:30:00 EDT America/New_York +bs4 2010-11-07 02:30:00 EST America/New_York - PT23H = 2010-11-06 04:30:00 EDT America/New_York +bs5 2010-11-07 01:30:00 EST America/New_York - PT22H = 2010-11-06 04:30:00 EDT America/New_York +bs6 2010-11-07 01:30:00 EDT America/New_York - PT21H = 2010-11-06 04:30:00 EDT America/New_York +bs7 2010-11-07 01:30:00 EDT America/New_York - P1D = 2010-11-06 01:30:00 EDT America/New_York +bs8 2010-11-07 01:30:00 EST America/New_York - P1DT1H = 2010-11-06 00:30:00 EDT America/New_York +bs9 2010-11-07 03:30:00 EST America/New_York - P1D = 2010-11-06 03:30:00 EDT America/New_York +bs10 2010-11-07 02:30:00 EST America/New_York - P1D = 2010-11-06 02:30:00 EDT America/New_York diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt index 151a7d206..7b72ca51e 100644 --- a/ext/date/tests/strftime_variation22.phpt +++ b/ext/date/tests/strftime_variation22.phpt @@ -5,8 +5,8 @@ Test strftime() function : usage variation - Checking Preferred date and time re if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { die("skip Test is not valid for Windows"); } -if(!setlocale(LC_ALL, "en_US.utf8", "en_US")) { - die("skip Locale en_US.utf8 or en_US is needed by test and is not available"); +if(!setlocale(LC_ALL, "POSIX")) { + die("skip Locale POSIX is needed by test and is not available"); } ?> --FILE-- @@ -20,7 +20,8 @@ if(!setlocale(LC_ALL, "en_US.utf8", "en_US")) { echo "*** Testing strftime() : usage variation ***\n"; // Initialise function arguments not being substituted (if any) -setlocale(LC_ALL, "en_US.utf8", "en_US"); +setlocale(LC_ALL, "POSIX"); +putenv("LC_ALL=POSIX"); date_default_timezone_set("Asia/Calcutta"); $timestamp = mktime(8, 8, 8, 8, 8, 2008); @@ -46,13 +47,13 @@ foreach($inputs as $key =>$value) { --Preferred date and time representation-- string(2) "%c" -string(31) "Fri 08 Aug 2008 08:08:08 AM IST" +string(24) "Fri Aug 8 08:08:08 2008" --Preferred date representation-- string(2) "%x" -string(10) "08/08/2008" +string(8) "08/08/08" --Preferred time representation-- string(2) "%X" -string(11) "08:08:08 AM" +string(8) "08:08:08" ===DONE=== diff --git a/ext/date/tests/timezone-configuration.phpt b/ext/date/tests/timezone-configuration.phpt index efd248977..c70d6456d 100644 --- a/ext/date/tests/timezone-configuration.phpt +++ b/ext/date/tests/timezone-configuration.phpt @@ -4,10 +4,10 @@ timezone configuration [1] date.timezone=GMT --FILE-- <?php - putenv('TZ=Europe/Oslo'); + date_default_timezone_set('Europe/Oslo'); echo strtotime("2005-06-18 22:15:44"), "\n"; - putenv('TZ=Europe/London'); + date_default_timezone_set('Europe/London'); echo strtotime("2005-06-18 22:15:44"), "\n"; date_default_timezone_set('Europe/Oslo'); |
