From:             tj at systisoft dot com
Operating system: Mac OS X
PHP version:      5.3CVS-2008-07-16 (CVS)
PHP Bug Type:     Date/time related
Bug description:  new DateTimeZone() and date_create()->getTimezone() behave 
diffent

Description:
------------
If you generate a DateTimeZone with new and one with
date_create()->getTimeZone, the resulting DateTimeZone objects behave
different even if the are of the same time zone.

Reproduce code:
---------------
$tz1 = new DateTimeZone('UTC');
$tz2 = date_create('UTC')->getTimeZone();
echo $tz1->getName(), PHP_EOL;
echo $tz2->getName(), PHP_EOL;
$d = new DateTime('2008-01-01 12:00:00+0200');
$d->setTimeZone($tz1);
echo $d->format(DATE_ISO8601), PHP_EOL;
$d = new DateTime('2008-01-01 12:00:00+0200');
$d->setTimeZone($tz2);
echo $d->format(DATE_ISO8601), PHP_EOL; 

Expected result:
----------------
UTC
UTC
2008-1-1T10:00:00+0000
2008-1-1T10:00:00+0000

Actual result:
--------------
UTC
UTC
2008-01-01T10:00:00+0000
PHP Warning:  DateTime::setTimezone(): Can only do this for zones with ID
for now in /Users/tobias/test.php on line 9

Warning: DateTime::setTimezone(): Can only do this for zones with ID for
now in /Users/tobias/test.php on line 9
2008-01-01T12:00:00+0200


-- 
Edit bug report at http://bugs.php.net/?id=45529&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45529&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45529&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45529&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45529&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45529&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45529&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45529&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45529&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45529&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45529&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45529&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45529&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45529&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45529&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45529&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45529&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45529&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45529&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45529&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45529&r=mysqlcfg

Reply via email to