Bug #67129 [NEW]: DateTimeZone incorrect offset for MDT
From: rmeyenburg at gmail dot com
Operating system: Win7x64 (32bit PHP)
PHP version: 5.5.11
Package: *General Issues
Bug Type: Bug
Bug description:DateTimeZone incorrect offset for MDT
Description:
------------
---
From manual page: http://www.php.net/datetimezone.getoffset
---
MDT (Mountain Daylight Time) is defined as UTC-6, while the PHP
DateTimeZone object reports the offset as UTC-7 (same as MST/Mountain
Standard Time).
Two tests are performed to check that day of the year (in or out of
daylight saving's time) isn't effecting the result - MDT is always UTC-6
regardless of time of year (since UTC doesn't move)
Tested on PHP 5.5.11, 5.4.26, 5.3.28
NOTE: 5.5 differs from 5.4, 5.3
Untested (although perhaps implied) other Daylight time zones
(PDT,CDT,EDT,ADT,NDT)
Test script:
---------------
<?php
$zone=new \DateTimeZone("MDT");
$o1=$zone->getOffset(new \DateTime("2012-01-01",$zone))/3600;
$o2=$zone->getOffset(new \DateTime("2012-08-01",$zone))/3600;
echo "2012-01-01: ".($o1==-6?"Pass":"Fail ($o1)")."\n";
echo "2012-08-01: ".($o2==-6?"Pass":"Fail ($o2)")."\n";
Expected result:
----------------
2012-01-01: Pass
2012-08-01: Pass
Actual result:
--------------
// 5.5.11-Win32-VC11-x86
2012-01-01: Fail (-7)
2012-08-01: Fail (-7)
// 5.4.26-Win32-VC9-x86
2012-01-01: Fail (-7)
2012-08-01: Pass
// 5.3.28-Win32-VC9-x86
2012-01-01: Fail (-7)
2012-08-01: Pass
--
Edit bug report at https://bugs.php.net/bug.php?id=67129&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67129&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67129&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67129&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67129&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67129&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67129&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67129&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67129&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67129&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67129&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67129&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67129&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67129&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67129&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67129&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67129&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67129&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67129&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67129&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67129&r=mysqlcfg
Thread (5 messages)
- rmeyenburg at gmail dot com