diff options
Diffstat (limited to 'ext/date/tests')
| -rw-r--r-- | ext/date/tests/bug14561.phpt | 4 | ||||
| -rw-r--r-- | ext/date/tests/bug35414.phpt | 16 | ||||
| -rw-r--r-- | ext/date/tests/bug35422.phpt | 12 | ||||
| -rw-r--r-- | ext/date/tests/bug35425.phpt | 30 | ||||
| -rw-r--r-- | ext/date/tests/bug35456.phpt | 16 | ||||
| -rw-r--r-- | ext/date/tests/bug35499.phpt | 16 | ||||
| -rw-r--r-- | ext/date/tests/bug35624.phpt | 29 | ||||
| -rw-r--r-- | ext/date/tests/bug35630.phpt | 11 | ||||
| -rw-r--r-- | ext/date/tests/bug35699.phpt | 14 | ||||
| -rw-r--r-- | ext/date/tests/bug35705.phpt | 11 | ||||
| -rw-r--r-- | ext/date/tests/bug35885.phpt | 14 | ||||
| -rw-r--r-- | ext/date/tests/bug35887.phpt | 11 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-1.phpt | 8 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_get-2.phpt | 2 | ||||
| -rw-r--r-- | ext/date/tests/date_default_timezone_set-1.phpt | 6 | ||||
| -rw-r--r-- | ext/date/tests/mktime-2.phpt | 2 | ||||
| -rw-r--r-- | ext/date/tests/mktime-3.phpt | 4 |
17 files changed, 194 insertions, 12 deletions
diff --git a/ext/date/tests/bug14561.phpt b/ext/date/tests/bug14561.phpt index e2b6ef098..98638c3e4 100644 --- a/ext/date/tests/bug14561.phpt +++ b/ext/date/tests/bug14561.phpt @@ -3,8 +3,8 @@ Bug #14561 (strtotime() bug) --FILE-- <?php putenv("TZ=GMT"); -echo strtotime("19:30 Dec 17"), "\n"; -echo strtotime("Dec 17 19:30"), "\n"; +echo strtotime("19:30 Dec 17 2005"), "\n"; +echo strtotime("Dec 17 19:30 2005"), "\n"; ?> --EXPECT-- 1134847800 diff --git a/ext/date/tests/bug35414.phpt b/ext/date/tests/bug35414.phpt new file mode 100644 index 000000000..f6af5110f --- /dev/null +++ b/ext/date/tests/bug35414.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #35414 (strtotime() no longer works with ordinal suffix) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime("Sat 26th Nov 2005 18:18")) . "\n"; +echo date(DATE_ISO8601, strtotime("26th Nov", 1134340285)) . "\n"; +echo date(DATE_ISO8601, strtotime("Dec. 4th, 2005")) . "\n"; +echo date(DATE_ISO8601, strtotime("December 4th, 2005")) . "\n"; +?> +--EXPECT-- +2005-11-26T18:18:00+0000 +2005-11-26T00:00:00+0000 +2005-12-04T00:00:00+0000 +2005-12-04T00:00:00+0000 diff --git a/ext/date/tests/bug35422.phpt b/ext/date/tests/bug35422.phpt new file mode 100644 index 000000000..8273c7541 --- /dev/null +++ b/ext/date/tests/bug35422.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #35422 (strtotime() does not parse times with UTC as timezone) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime("July 1, 2000 00:00:00 UTC")) . "\n"; +echo date(DATE_ISO8601, strtotime("July 1, 2000 00:00:00 GMT")) . "\n"; +?> +--EXPECT-- +2000-07-01T00:00:00+0000 +2000-07-01T00:00:00+0000 diff --git a/ext/date/tests/bug35425.phpt b/ext/date/tests/bug35425.phpt new file mode 100644 index 000000000..4259b49a1 --- /dev/null +++ b/ext/date/tests/bug35425.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #35425 (idate() function ignores timezone settings) +--FILE-- +<?php +putenv('TZ=America/Montreal'); + +$time = mktime(1,1,1,1,1,2005); +foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) { + var_dump(idate($v, $time)); +} + +?> +--EXPECT-- +int(292) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(31) +int(1104559261) +int(6) +int(53) +int(5) +int(2005) +int(0) +int(-18000) diff --git a/ext/date/tests/bug35456.phpt b/ext/date/tests/bug35456.phpt new file mode 100644 index 000000000..6432b9944 --- /dev/null +++ b/ext/date/tests/bug35456.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #35456 (+ 1 [time unit] format did not work) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +$t = 1133216119; + +echo date(DATE_ISO8601, strtotime("+ 1 day", $t)) . "\n"; +echo date(DATE_ISO8601, strtotime("+ 1 month", $t)) . "\n"; +echo date(DATE_ISO8601, strtotime("+ 1 week", $t)) . "\n"; +?> +--EXPECT-- +2005-11-29T22:15:19+0000 +2005-12-28T22:15:19+0000 +2005-12-05T22:15:19+0000 diff --git a/ext/date/tests/bug35499.phpt b/ext/date/tests/bug35499.phpt new file mode 100644 index 000000000..2fbcbf0bf --- /dev/null +++ b/ext/date/tests/bug35499.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #35499 (strtotime() does not handle whitespace around the date string) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime("11/20/2005 8:00 AM \r\n")) . "\n"; +echo date(DATE_ISO8601, strtotime(" 11/20/2005 8:00 AM \r\n")) . "\n"; +var_dump(strtotime(" a ")); +var_dump(strtotime(" \n ")); +?> +--EXPECT-- +2005-11-20T08:00:00+0000 +2005-11-20T08:00:00+0000 +bool(false) +bool(false) diff --git a/ext/date/tests/bug35624.phpt b/ext/date/tests/bug35624.phpt new file mode 100644 index 000000000..722adba82 --- /dev/null +++ b/ext/date/tests/bug35624.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #35624 (strtotime() does not handle 3 character weekdays) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +$days = array("monday","mon","tuesday","tue","wednesday","wed","thursday","thu","friday","fri","saturday","sat","sunday","sun"); + +foreach ($days as $day) { + echo date("D", strtotime($day)); + echo date("D", strtotime(ucfirst($day))); + echo "\n"; +} +?> +--EXPECT-- +MonMon +MonMon +TueTue +TueTue +WedWed +WedWed +ThuThu +ThuThu +FriFri +FriFri +SatSat +SatSat +SunSun +SunSun diff --git a/ext/date/tests/bug35630.phpt b/ext/date/tests/bug35630.phpt new file mode 100644 index 000000000..b111b1aaf --- /dev/null +++ b/ext/date/tests/bug35630.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35630 (strtotime() crashes on non-separated relative modifiers) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime('5 january 2006+3day+1day')) . "\n"; + +?> +--EXPECT-- +2006-01-09T00:00:00+0000 diff --git a/ext/date/tests/bug35699.phpt b/ext/date/tests/bug35699.phpt new file mode 100644 index 000000000..5e4951e9f --- /dev/null +++ b/ext/date/tests/bug35699.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35699 (date() can't handle leap years before 1970) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime('1964-06-06')), "\n"; +echo date(DATE_ISO8601, strtotime('1963-06-06')), "\n"; +echo date(DATE_ISO8601, strtotime('1964-01-06')), "\n"; +?> +--EXPECT-- +1964-06-06T00:00:00+0000 +1963-06-06T00:00:00+0000 +1964-01-06T00:00:00+0000 diff --git a/ext/date/tests/bug35705.phpt b/ext/date/tests/bug35705.phpt new file mode 100644 index 000000000..6894160a4 --- /dev/null +++ b/ext/date/tests/bug35705.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35705 (strtotime() fails to parse soap date format without TZ) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime('2000-10-10T10:12:30.000')) . "\n"; + +?> +--EXPECT-- +2000-10-10T10:12:30+0000 diff --git a/ext/date/tests/bug35885.phpt b/ext/date/tests/bug35885.phpt new file mode 100644 index 000000000..5f4e5d58c --- /dev/null +++ b/ext/date/tests/bug35885.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35885 (strtotime("NOW") no longer works) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +$ts = date(DATE_ISO8601, strtotime('NOW')); +$ts2 = date(DATE_ISO8601, time()); + +var_dump($ts == $ts2); + +?> +--EXPECT-- +bool(true) diff --git a/ext/date/tests/bug35887.phpt b/ext/date/tests/bug35887.phpt new file mode 100644 index 000000000..e6ea7bd38 --- /dev/null +++ b/ext/date/tests/bug35887.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35887 (wddx_deserialize not parsing dateTime fields properly) +--FILE-- +<?php +date_default_timezone_set("UTC"); + +echo date(DATE_ISO8601, strtotime('2006-1-6T0:0:0-8:0')) . "\n"; + +?> +--EXPECT-- +2006-01-06T08:00:00+0000 diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt index e6319bab5..b6494658e 100644 --- a/ext/date/tests/date_default_timezone_get-1.phpt +++ b/ext/date/tests/date_default_timezone_get-1.phpt @@ -9,8 +9,8 @@ date.timezone= echo date('e'), "\n"; ?> --EXPECTF-- -Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 -Europe/London +Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 +UTC -Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4 -Europe/London +Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4 +UTC diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt index 3fef09788..73013a762 100644 --- a/ext/date/tests/date_default_timezone_get-2.phpt +++ b/ext/date/tests/date_default_timezone_get-2.phpt @@ -8,5 +8,5 @@ date.timezone=CEST echo date_default_timezone_get(), "\n"; ?> --EXPECTF-- -Notice: date_default_timezone_get(): Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone in %sdate_default_timezone_get-2.php on line 3 +Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-2.php on line 3 UTC diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt index 90916e923..3c7a9aa4d 100644 --- a/ext/date/tests/date_default_timezone_set-1.phpt +++ b/ext/date/tests/date_default_timezone_set-1.phpt @@ -18,11 +18,11 @@ date.timezone= echo date(DATE_ISO8601, $date4), "\n"; ?> --EXPECTF-- -Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3 +Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3 -Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4 +Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4 America/Indiana/Knox 2005-01-12T03:00:00-0500 -2005-07-12T02:00:00-0500 +2005-07-12T03:00:00-0500 2005-01-12T08:00:00-0500 2005-07-12T08:00:00-0500 diff --git a/ext/date/tests/mktime-2.phpt b/ext/date/tests/mktime-2.phpt index 2b6e61867..aa259b577 100644 --- a/ext/date/tests/mktime-2.phpt +++ b/ext/date/tests/mktime-2.phpt @@ -3,7 +3,7 @@ mktime() [2] --INI-- error_reporting=2047 --FILE-- -<?php /* $Id: mktime-2.phpt,v 1.1.2.1 2005/08/09 21:10:22 derick Exp $ */ +<?php $timezones = array( 'GMT0', 'Europe/London' diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt index d4ccfbabe..0d19074fc 100644 --- a/ext/date/tests/mktime-3.phpt +++ b/ext/date/tests/mktime-3.phpt @@ -5,7 +5,7 @@ error_reporting=2047 --FILE-- <?php $tzs = array("America/Toronto", "Europe/Oslo"); -$years = array(0, 69, 70, 71, 99, 100, 1900, 1901, 1902, 1999, 2000, 2001); +$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001); foreach ($tzs as $tz) { echo $tz, "\n"; @@ -30,6 +30,7 @@ Y: 70 - January 1970-01-01T01:01:01-0500 Y: 71 - January 1971-01-01T01:01:01-0500 Y: 99 - January 1999-01-01T01:01:01-0500 Y: 100 - January 2000-01-01T01:01:01-0500 +Y: 105 - January 2005-01-01T01:01:01-0500 Y: 1900 - out of range Y: 1901 - out of range Y: 1902 - January 1902-01-01T01:01:01-0500 @@ -44,6 +45,7 @@ Y: 70 - January 1970-01-01T01:01:01+0100 Y: 71 - January 1971-01-01T01:01:01+0100 Y: 99 - January 1999-01-01T01:01:01+0100 Y: 100 - January 2000-01-01T01:01:01+0100 +Y: 105 - January 2005-01-01T01:01:01+0100 Y: 1900 - out of range Y: 1901 - out of range Y: 1902 - January 1902-01-01T01:01:01+0100 |
