Edit report at https://bugs.php.net/bug.php?id=52142&edit=1
ID: 52142 Updated by: der...@php.net Reported by: riccardo at mercuriosistemi dot com Summary: using diff change the datetime object -Status: Assigned +Status: Closed Type: Bug Package: Date/time related Operating System: slackware PHP Version: 5.3.2 Assigned To: derick Block user comment: N Private report: N New Comment: Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Somebody had applied this patch already, so closing. Previous Comments: ------------------------------------------------------------------------ [2010-08-15 23:20:27] strager dot nds at gmail dot com Eh, also, this is from the 5.3.3 release of PHP. Tested on: Linux strager-desktop 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux ------------------------------------------------------------------------ [2010-08-15 23:19:21] strager dot nds at gmail dot com Wrote a test case and a fix for this bug. See attached patches. ------------------------------------------------------------------------ [2010-06-22 12:40:46] riccardo at mercuriosistemi dot com Description: ------------ A DateTime object with timezone_type=1 is always set to timezone=+00:00 after the use of diff Test script: --------------- date_default_timezone_set( "Europe/Rome" ); $da = new DateTime('2010-06-22T00:00:00+02:00'); $a = new DateTime('2010/06/23'); print_r($da); $da->diff($a); // $da has been changed print_r($da); Expected result: ---------------- DateTime Object ( [date] => 2010-06-22 00:00:00 [timezone_type] => 1 [timezone] => +02:00 ) DateTime Object ( [date] => 2010-06-21 22:00:00 [timezone_type] => 1 [timezone] => +02:00 ) Actual result: -------------- DateTime Object ( [date] => 2010-06-22 00:00:00 [timezone_type] => 1 [timezone] => +02:00 ) DateTime Object ( [date] => 2010-06-21 22:00:00 [timezone_type] => 1 [timezone] => +00:00 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=52142&edit=1