From:             astax dot t at gmail dot com
Operating system: Linux
PHP version:      5.2.6
PHP Bug Type:     Date/time related
Bug description:  Crash when using DateTimeZone object returned by 
Date::getTimezone

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

Reply via email to