Annotation of embedaddon/php/ext/date/tests/bug27780.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
! 3: --SKIPIF--
! 4: <?php
! 5: if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
! 6: die("skip. Not the same TZ on windows.");
! 7: }
! 8: --FILE--
! 9: <?php
! 10: $timezones = array (
! 11: "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem",
! 12: "Asia/Singapore", "America/Sao_Paulo"
! 13: );
! 14:
! 15: $timestrings = array (
! 16: "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds",
! 17: "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds",
! 18: "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds",
! 19: "2004-04-07 00:00:00 -21 days",
! 20: "2004-04-07 00:00:00 11 days ago",
! 21: "2004-04-07 00:00:00 -10 day +2 hours",
! 22: "2004-04-07 00:00:00 -1 day",
! 23: "2004-04-07 00:00:00",
! 24: "2004-04-07 00:00:00 +1 hour",
! 25: "2004-04-07 00:00:00 +2 hour",
! 26: "2004-04-07 00:00:00 +1 day",
! 27: "2004-04-07 00:00:00 1 day",
! 28: "2004-04-07 00:00:00 +21 days",
! 29: );
! 30:
! 31: foreach ($timezones as $timezone) {
! 32: date_default_timezone_set($timezone);
! 33: echo $timezone, "\n";
! 34:
! 35: foreach ($timestrings as $timestring) {
! 36: $time = strtotime($timestring);
! 37:
! 38: echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n";
! 39: }
! 40:
! 41: echo "\n";
! 42: }
! 43: ?>
! 44: --EXPECT--
! 45: America/Chicago
! 46: 1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
! 47: 1076824800 [2004-02-15 00:00:00 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
! 48: 1076824801 [2004-02-15 00:00:01 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
! 49: 1079503200 [2004-03-17 00:00:00 CST] [2004-04-07 00:00:00 -21 days]
! 50: 1080367200 [2004-03-27 00:00:00 CST] [2004-04-07 00:00:00 11 days ago]
! 51: 1080460800 [2004-03-28 02:00:00 CST] [2004-04-07 00:00:00 -10 day +2 hours]
! 52: 1081227600 [2004-04-06 00:00:00 CDT] [2004-04-07 00:00:00 -1 day]
! 53: 1081314000 [2004-04-07 00:00:00 CDT] [2004-04-07 00:00:00]
! 54: 1081317600 [2004-04-07 01:00:00 CDT] [2004-04-07 00:00:00 +1 hour]
! 55: 1081321200 [2004-04-07 02:00:00 CDT] [2004-04-07 00:00:00 +2 hour]
! 56: 1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 +1 day]
! 57: 1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 1 day]
! 58: 1083128400 [2004-04-28 00:00:00 CDT] [2004-04-07 00:00:00 +21 days]
! 59:
! 60: Europe/Amsterdam
! 61: 1076799599 [2004-02-14 23:59:59 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
! 62: 1076799600 [2004-02-15 00:00:00 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
! 63: 1076799601 [2004-02-15 00:00:01 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
! 64: 1079478000 [2004-03-17 00:00:00 CET] [2004-04-07 00:00:00 -21 days]
! 65: 1080342000 [2004-03-27 00:00:00 CET] [2004-04-07 00:00:00 11 days ago]
! 66: 1080435600 [2004-03-28 03:00:00 CEST] [2004-04-07 00:00:00 -10 day +2 hours]
! 67: 1081202400 [2004-04-06 00:00:00 CEST] [2004-04-07 00:00:00 -1 day]
! 68: 1081288800 [2004-04-07 00:00:00 CEST] [2004-04-07 00:00:00]
! 69: 1081292400 [2004-04-07 01:00:00 CEST] [2004-04-07 00:00:00 +1 hour]
! 70: 1081296000 [2004-04-07 02:00:00 CEST] [2004-04-07 00:00:00 +2 hour]
! 71: 1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 +1 day]
! 72: 1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 1 day]
! 73: 1083103200 [2004-04-28 00:00:00 CEST] [2004-04-07 00:00:00 +21 days]
! 74:
! 75: Asia/Jerusalem
! 76: 1076795999 [2004-02-14 23:59:59 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
! 77: 1076796000 [2004-02-15 00:00:00 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
! 78: 1076796001 [2004-02-15 00:00:01 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
! 79: 1079474400 [2004-03-17 00:00:00 IST] [2004-04-07 00:00:00 -21 days]
! 80: 1080338400 [2004-03-27 00:00:00 IST] [2004-04-07 00:00:00 11 days ago]
! 81: 1080432000 [2004-03-28 02:00:00 IST] [2004-04-07 00:00:00 -10 day +2 hours]
! 82: 1081202400 [2004-04-06 00:00:00 IST] [2004-04-07 00:00:00 -1 day]
! 83: 1081288800 [2004-04-07 00:00:00 IST] [2004-04-07 00:00:00]
! 84: 1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +1 hour]
! 85: 1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +2 hour]
! 86: 1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 +1 day]
! 87: 1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 1 day]
! 88: 1083099600 [2004-04-28 00:00:00 IDT] [2004-04-07 00:00:00 +21 days]
! 89:
! 90: Asia/Singapore
! 91: 1076774399 [2004-02-14 23:59:59 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
! 92: 1076774400 [2004-02-15 00:00:00 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
! 93: 1076774401 [2004-02-15 00:00:01 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
! 94: 1079452800 [2004-03-17 00:00:00 SGT] [2004-04-07 00:00:00 -21 days]
! 95: 1080316800 [2004-03-27 00:00:00 SGT] [2004-04-07 00:00:00 11 days ago]
! 96: 1080410400 [2004-03-28 02:00:00 SGT] [2004-04-07 00:00:00 -10 day +2 hours]
! 97: 1081180800 [2004-04-06 00:00:00 SGT] [2004-04-07 00:00:00 -1 day]
! 98: 1081267200 [2004-04-07 00:00:00 SGT] [2004-04-07 00:00:00]
! 99: 1081270800 [2004-04-07 01:00:00 SGT] [2004-04-07 00:00:00 +1 hour]
! 100: 1081274400 [2004-04-07 02:00:00 SGT] [2004-04-07 00:00:00 +2 hour]
! 101: 1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 +1 day]
! 102: 1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 1 day]
! 103: 1083081600 [2004-04-28 00:00:00 SGT] [2004-04-07 00:00:00 +21 days]
! 104:
! 105: America/Sao_Paulo
! 106: 1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
! 107: 1076814000 [2004-02-15 00:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
! 108: 1076814001 [2004-02-15 00:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
! 109: 1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days]
! 110: 1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago]
! 111: 1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours]
! 112: 1081220400 [2004-04-06 00:00:00 BRT] [2004-04-07 00:00:00 -1 day]
! 113: 1081306800 [2004-04-07 00:00:00 BRT] [2004-04-07 00:00:00]
! 114: 1081310400 [2004-04-07 01:00:00 BRT] [2004-04-07 00:00:00 +1 hour]
! 115: 1081314000 [2004-04-07 02:00:00 BRT] [2004-04-07 00:00:00 +2 hour]
! 116: 1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 +1 day]
! 117: 1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 1 day]
! 118: 1083121200 [2004-04-28 00:00:00 BRT] [2004-04-07 00:00:00 +21 days]
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>