From:             
Operating system: Linux / Mac
PHP version:      5.3.12
Package:          Date/time related
Bug Type:         Bug
Bug description:Adding DateInterval to DateTime adds 1 additional hour

Description:
------------
When I create a DateTime object from a (any) timestamp and then add a
DateInterval object to the DateTime object, the time in the DateInterval
object is added and one additional hour is also added.

I have not noticed this behavior in versions up to and including 5.3.8,
only in newer 5.3 versions. (I did not test in 5.4.)
Also the behavior is related to the default time zone, even though the
created DateTime object is in UTC. I have tested several timezones and it
appears that all Europe/* and North American America/* timezones are
affected. The Australian timezones seem to be unaffected.

Information from phpinfo():
date
- date/time support => enabled
- "Olson" Timezone Database Version => 2012.3
- Timezone Database => internal


Test script:
---------------
date_default_timezone_set('Europe/Amsterdam');
$d1 = new DateTime('@0');
$d2 = clone($d1);
$d2->add(new DateInterval('PT5S'));
var_dump($d2);


Expected result:
----------------
object(DateTime)[2]
  public 'date' => string '1970-01-01 00:00:05' (length=19)
  public 'timezone_type' => int 1
  public 'timezone' => string '+00:00' (length=6)

Actual result:
--------------
object(DateTime)[2]
  public 'date' => string '1970-01-01 01:00:05' (length=19)
  public 'timezone_type' => int 1
  public 'timezone' => string '+00:00' (length=6)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=61955&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61955&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61955&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61955&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61955&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61955&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61955&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61955&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61955&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61955&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61955&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61955&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61955&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61955&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61955&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61955&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61955&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61955&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61955&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61955&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61955&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61955&r=mysqlcfg

Reply via email to