Edit report at http://bugs.php.net/bug.php?id=52142&edit=1
ID: 52142
Comment by: strager dot nds at gmail dot com
Reported by: riccardo at mercuriosistemi dot com
Summary: using diff change the datetime object
Status: Assigned
Type: Bug
Package: Date/time related
Operating System: slackware
PHP Version: 5.3.2
Assigned To: derick
Block user comment: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/bug.php?id=52142&edit=1