|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-11-22 17:38 UTC] 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 ?? ()
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
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) { }