ID: 43377 Updated by: [EMAIL PROTECTED] -Summary: PHP crashes with invalid argument for DateTimeZone Reported By: nils at script-solution dot de -Status: Closed +Status: Verified -Bug Type: Date/time related +Bug Type: Scripting Engine problem Operating System: Ubuntu 7.10; 2.6.22-14-generic PHP Version: 5.2.5 New Comment:
Re-opening (reclassified & updated summary) The problem isn't in ext/datetime. All exception thrown via zend_parse_parameters() are caught by a user defined error handler: <?php function err() { echo "User defined errorhandler triggered\n"; } set_error_handler("err"); $obj = new ArrayObject(null, "foobar"); var_dump($obj);' ?> User defined errorhandler triggered object(ArrayObject)#1 (0) { } Previous Comments: ------------------------------------------------------------------------ [2007-11-23 00:16:55] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2007-11-22 17:38:46] nils at script-solution dot de 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 this bug report at http://bugs.php.net/?id=43377&edit=1