From: tj at systisoft dot com Operating system: All PHP version: 5.3CVS-2008-07-16 (CVS) PHP Bug Type: Feature/Change Request Bug description: You cannot initialize a DateTimeZone object by offset only.
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 bug report at http://bugs.php.net/?id=45528&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45528&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45528&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45528&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45528&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45528&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45528&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45528&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45528&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45528&r=support Expected behavior: http://bugs.php.net/fix.php?id=45528&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45528&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45528&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45528&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45528&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45528&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45528&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45528&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45528&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45528&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45528&r=mysqlcfg