diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
|---|---|---|
| committer | <> | 2013-04-03 16:25:08 +0000 |
| commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
| tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/date/tests/bug33532.phpt | |
| download | php2-master.tar.gz | |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/date/tests/bug33532.phpt')
| -rw-r--r-- | ext/date/tests/bug33532.phpt | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ext/date/tests/bug33532.phpt b/ext/date/tests/bug33532.phpt new file mode 100644 index 0000000..1486308 --- /dev/null +++ b/ext/date/tests/bug33532.phpt @@ -0,0 +1,43 @@ +--TEST-- +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 + +setlocale(LC_ALL, 'C'); + +print "TZ has NOT been set\n"; +print "Should strftime==datestr? Strftime seems to assume GMT tStamp.\n"; +$input = "10:00:00 AM July 1 2005"; +print "input " . $input . "\n"; +$tStamp = strtotime($input); +print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n"; +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); +print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n"; +print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n"; + +?> +--EXPECT-- +TZ has NOT been set +Should strftime==datestr? Strftime seems to assume GMT tStamp. +input 10:00:00 AM July 1 2005 +strftime 10:00:00 AM July 1 2005 UTC +0000 +datestr 10:00:00 AM July 1 2005 UTC + +Setting TZ +input 10:00:00 AM July 1 2005 +strftime 10:00:00 AM July 1 2005 EST +1000 +datestr 10:00:00 AM July 1 2005 EST |
