Bug #52142 [NEW]: using diff change the datetime object
| From: | riccardo at mercuriosistemi dot com | Date: | Tue, 22 Jun 2010 10:41:02 +0000 |
| Subject: | Bug #52142 [NEW]: using diff change the datetime object | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-151761@lists.php.net to get a copy of this message | ||
From:
Operating system: slackware
PHP version: 5.3.2
Package: Date/time related
Bug Type: Bug
Bug description:using diff change the datetime object
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 bug report at http://bugs.php.net/bug.php?id=52142&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52142&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52142&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52142&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52142&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52142&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52142&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52142&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52142&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52142&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52142&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52142&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52142&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52142&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52142&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52142&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52142&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52142&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52142&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52142&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52142&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52142&r=mysqlcfg