#45038 [Opn->Asn]: Crash when using DateTimeZone object returned by Date::getTimezone
| From: | felipe@php.net | Date: | Tue, 27 May 2008 10:46:51 +0000 |
| Subject: | #45038 [Opn->Asn]: Crash when using DateTimeZone object returned by Date::getTimezone | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125297@lists.php.net to get a copy of this message | ||
ID: 45038
Updated by: felipe@php.net
Reported By: astax dot t at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Linux
PHP Version: 5.2.6
-Assigned To:
+Assigned To: derick
New Comment:
Wait and rely. :)
Assigned to maintainer.
Previous Comments:
------------------------------------------------------------------------
[2008-05-27 08:23:31] astax dot t at gmail dot com
Any chance for this to be fixed?
------------------------------------------------------------------------
[2008-05-19 10:13:43] astax dot t at gmail dot com
Description:
------------
Crash when using DateTimeZone object, previously returned by
DateTime::getTimezone()
This worked fine in PHP 5.2.5
Probably this is related to how DateTimeZone object is returned:
This code returns different results in 5.2.5 and 5.2.6
$old_tz = $d->getTimezone();
$d->setTimezone(new DateTimeZone('UTC'));
echo $old_tz->getName();
5.2.6 returns 'UTC', while 5.2.5 returns 'Asia/Novosibirsk' (my current
timezone). Having in mind how objects in PHP5 are returned, I can accept
this, but this must be documented properly and shouldn't cause crash.
Reproduce code:
---------------
$d = new DateTime();
$old_tz = $d->getTimezone();
$d->setTimezone(new DateTimeZone('UTC'));
// setDate() and setTime() may go here - just for this example to make
some sense
$d->setTimezone($old_tz);
echo "Success";
Expected result:
----------------
Success
Actual result:
--------------
PHP interpreter crashes
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45038&edit=1