#840182: Testing is broken put PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0 in my Apache error log. Even if that issue is fixed, just revert the short patch and fix exception handling. I won't. I had my say about exceptions. Good luck playing whack-a-mole with this error message.

Comments

chx’s picture

Priority: Critical » Normal

It seems you need to have a batch and an exception thrown in a shutdown function for this happen. Merely throwing an exception from shutdown is not enough. No matter how much it annoys me that's not critical.

berdir’s picture

Did not get #1. Will that be displayed even when using drupal_register_shutdown_function() instead of register_shutdown_function? If no, then I don't see your point, avoiding exactly these errors is the reason of drupal_register_shutdown_function()'s existance...

chx’s picture

drupal_register_shutdown_function only helped the parent issue because it caused simpletest to remove the call to the offending function. Just try creating a batch that throws an exception in a shutdown function and you will see. For example, add register_shutdown_function('test_throw') and function test_throw() { global $testing; if ($testing) throw new Exception('test');} to index.php and flip the global in simpletest setUp and run a test. Ka-boom. Or, as the original post says, just change back the drupal_register_shutdown_function to register_shutdown_function in mysql/database.inc nextId

berdir’s picture

Status: Active » Closed (won't fix)

drupal_register_shutdown_function() does more than that. It also explicitly catches all exceptions thrown in shutdown functions and displays them nicely, as you can see here: http://api.drupal.org/api/function/_drupal_shutdown_function/7

As I said, in your example you used again register_shutdown_function(). Your example code even fails without checking $testing and simply accessing index.php

If you use drupal_register_shutdown_function(), you will instead see the following:

Uncaught exception thrown in shutdown function.Exception: test in test_throw() (line 27 of index.php).

This might not be perfect, but there is not much more we can do at that time and you can see what exception was thrown and where.

I tested this both with your method during testing and directly.