-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exception from ZEND_EXIT overload #17
Comments
You can still throw an exception, nothing has changed in that regard. <?php
class Unit {
public function test() {
exit(10);
}
}
class Uopz_Test extends PHPUnit_Framework_TestCase
{
public static function setupBeforeClass() {
uopz_overload(ZEND_EXIT, function($status = 0) {
throw new Exception("test");
});
}
public function testExit()
{
$unit = new Unit();
$unit->test();
$this->assertTrue(true);
}
public static function teardownAfterClass() {
uopz_overload(ZEND_EXIT, null);
}
}
?> This is fine, and still make sense. When you throw, you are instructing the executor to leave the current block (scope), which is what you are doing when you return |
thanks for your quick response!
the output I get from strace right before the crash is:
let me know if you need any more information to debug this. |
These changes are only in master right now, and are tentative (unreleased) |
ok, thanks. I tried the code from git and it worked. the segfault was a problem somewhere in my setup. |
with older versions of uopz I used to be able to raise an exception from a ZEND_EXIT overload, which I would catch/expect in PHPUnit.
the latest changes seem to make this impossible, since I now have to return something from the overload function in order to continue execution.
is this change supposed to break behaviour? can I still throw exceptions in the overload somehow or do I have to refactor my testsuite?
The text was updated successfully, but these errors were encountered: