php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43377 Exceptions caught by user defined error handler
Submitted: 2007-11-22 17:38 UTC Modified: 2008-06-19 11:02 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: nils at script-solution dot de Assigned: colder (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Ubuntu 7.10; 2.6.22-14-generic
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nils at script-solution dot de
New email:
PHP Version: OS:

 

 [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 ?? ()

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-23 00:16 UTC] iliaa@php.net
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-23 10:09 UTC] bjori@php.net
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) {
}

 [2008-06-19 11:02 UTC] colder@php.net
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.

Fixed in 5_3 and HEAD, won't be backported to 5_2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 10:01:28 2024 UTC