ID:               45528
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tj at systisoft dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: All
 PHP Version:      5.3CVS-2008-07-16 (CVS)
-Assigned To:      
+Assigned To:      derick


Previous Comments:
------------------------------------------------------------------------

[2008-07-16 09:58:17] tj at systisoft dot com

Description:
------------
Sometimes you get timezones from other sources in offset only format.
This is often the case when dealing with databases.

So yo have sometimes the situation where you have to set a time zone to
a DateTime that is only defined by the offset. While an offset alone is
not a time zone the DateTimeZone object can handle them by treating them
as a time zone without daylight saving and offset, the name of that time
zone is the offset itself. This seems to be the way if such time zones
are obtained from a DateTime object. 

It would be nice behavior if new DateTimeZone($d->getName()) will
always succeed if $d is a DateTimeZone.

Reproduce code:
---------------
$d = new
DateTimeZone(date_create('+01:00')->getTimeZone()->getName());
echo $d->getName();

Expected result:
----------------
+01:00

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'Exception' with message
'DateTimeZone::__construct(): Unknown or bad timezone (+01:00)' in
Command line code:1


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45528&edit=1

Reply via email to