Bug #67001 [NEW]: Time functions affected by machine timezone and current time
From: danmath01 at yahoo dot com dot ar
Operating system: Windows + Linux
PHP version: Irrelevant
Package: Date/time related
Bug Type: Bug
Bug description:Time functions affected by machine timezone and current time
Description:
------------
Given an input the DateTime class will produce outputs that are affected
by the current default timezone and the current time. The test script
provided uses the timestamp for 2013-01-01 00:00:00 and shows that
adding 0 minutes can return a result that is 1 hour later. This was
observed running the script on the 31st of March 2014, during BST (end
of March to end of October), although the localtime should not affect
the script. Changing the localtime back 1 week or moving it past October
and running the script produces the correct output. This was observed on
both Windows with PHP 5.4.7 and on Linux with PHP 5.3.27 and not
reproducible on Linux with PHP 5.3.3.
Test script:
---------------
<?php
date_default_timezone_set('Europe/London');
echo date_default_timezone_get(), "\n";
$timestamp= new DateTime("@1356998400");
echo $timestamp->format('Y-m-d H:i:s'), "\n";
$timestamp->modify("+ 0 minutes");
echo $timestamp->format('Y-m-d H:i:s'), "\n";
?>
Expected result:
----------------
Europe/London
2013-01-01 00:00:00
2013-01-01 00:00:00
5.4.7
Actual result:
--------------
Europe/London
2013-01-01 00:00:00
2013-01-01 01:00:00
5.4.7
--
Edit bug report at https://bugs.php.net/bug.php?id=67001&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67001&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67001&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67001&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=67001&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=67001&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=67001&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=67001&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=67001&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=67001&r=support
Expected behavior: https://bugs.php.net/fix.php?id=67001&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=67001&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=67001&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=67001&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67001&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=67001&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=67001&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=67001&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=67001&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=67001&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=67001&r=mysqlcfg
Thread (3 messages)
- danmath01 at yahoo dot com dot ar