Comments (4)
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 ZEND_USER_OPCODE_RETURN
.
from uopz.
thanks for your quick response!
unfortunately I get a segfault when I try to run your code with
- PHP 5.5.22 (cli) (built: Feb 19 2015 07:04:43)
- with uopz v2.0.7 from PECL
- PHPUnit 4.5.0
the output I get from strace right before the crash is:
open("/usr/local/bin/phpunit", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0775, st_size=3411356, ...}) = 0
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 2662017, SEEK_SET) = 2662017
read(3, "<?php\n/**\n * GlobalState\n *\n * C"..., 8192) = 8192
lseek(3, 2670209, SEEK_SET) = 2670209
read(3, " foreach ($superGlobalArrays as "..., 8192) = 8192
lseek(3, 2673320, SEEK_SET) = 2673320
brk(0) = 0x7f79e5265000
brk(0x7f79e52a5000) = 0x7f79e52a5000
close(3) = 0
getcwd("/home/user/src/unittests", 4096) = 28
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x209} ---
+++ killed by SIGSEGV (core dumped) +++
let me know if you need any more information to debug this.
from uopz.
with uopz v2.0.7 from PECL
These changes are only in master right now, and are tentative (unreleased)
from uopz.
ok, thanks. I tried the code from git and it worked. the segfault was a problem somewhere in my setup.
from uopz.
Related Issues (20)
- Release HOT 4
- zend_mm_heap corrupted HOT 8
- appveyor HOT 4
- phpunit9+mockery Segfault HOT 8
- constant redefinition HOT 2
- uopz_extend HOT 2
- 7.1.0 HOT 5
- User stream filter segfault in uopz_find_return during request shutdown HOT 4
- error: implicit declaration of function 'RETURN_THROWS' is invalid in C99 HOT 1
- Feature request: Function to reset PHP memory peak usage on runtime HOT 6
- 8.1 bugfix release HOT 2
- Build issue with 8.1.1RC1 HOT 3
- Segfault in test suite with 8.1.2 HOT 5
- make error HOT 5
- Repro pattern for SIGSEGV with PHPUnit ^9.5 HOT 4
- uopz_get_return incorrectly returns null if the method/function name contains upper-case characters HOT 1
- Uopz seems to kill composer autoload HOT 5
- uopz_set_return() overload confusion HOT 2
- can we use uopz extension as alternative for tideways HOT 1
- Does this affect performance if used in production code? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uopz.