I have found the problem and resolved it. I wasnt about the destructor as described in the bugs.php.net report.
My init script sets errorhandler here:
$oldErrorhandler = set_error_handler('error_handler', E_ALL);
Later it initializes pear and sets my own error handler:
autoload_file('lib/PEAR/DB.php', true);
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_error_handler');
And then connects from my own wrapper
// PEAR::DB will not be compat to E_STRICT (authors words)
$db =& DB::connect($dbh, $options);
BUT. The function containing this connect method, (my own), returned $db without checking... silly me 🙂
What i needed to do was:
if (PEAR::isError($db)) {
trigger_error($db->getMessage(), E_USER_ERROR);
die();
}
Without that check, my pear_error_handler was used (2), and In there, I violently threw an exception.
Changing that to do a trigger_error instead solves the problem. Im not completely sure why, but it seems not allowed to throw exceptions from with ANY errorhandler. Then this error occurs. (reproducable on both Linux & Win32)