From: nils at script-solution dot de
Operating system: Ubuntu 7.10; 2.6.22-14-generic
PHP version: 5.2.5
PHP Bug Type: Date/time related
Bug description: PHP crashes with invalid argument for DateTimeZone
Description:
------------
If no custom error-handler is defined via set_error_handler() it works
like I would expect it. If I pass an invalid argument to the constructor of
DateTimeZone an exception is thrown with "Unknown or bad timezone (...)".
But as soon as I define a custom error-handler the behavior changes.
The creation of DateTimeZone causes no problem. But if I pass the created
object to DateTime PHP crashes.
Reproduce code:
---------------
<?php
function handleError() {}
set_error_handler('handleError');
$t = new DateTimeZone('something');
$d = new DateTime('now',$t);
?>
Expected result:
----------------
Of course, PHP should not crash but trigger an error / throw an exception
:)
Actual result:
--------------
I've tried to get the backtrace. I don't know if I've done this correctly.
The howto linked on this page doesn't work for me. I've done the
following:
$ gdb /usr/bin/php5
$(gdb) run myfile.php
$(gdb) bt
The result is:
Program received signal SIGSEGV, Segmentation fault.
#0 0x080dff87 in timelib_tzinfo_clone ()
#1 0x080c5e63 in zif_date_timezone_set ()
#2 0x082e0e32 in ?? ()
#3 0x00000001 in ?? ()
#4 0x086d1b30 in ?? ()
#5 0x00000000 in ?? ()
--
Edit bug report at http://bugs.php.net/?id=43377&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43377&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43377&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43377&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43377&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43377&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43377&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43377&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43377&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43377&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43377&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43377&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43377&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43377&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43377&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43377&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43377&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43377&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43377&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43377&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43377&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43377&r=mysqlcfg