php-src/Zend/tests/fibers/backtrace-nested.phpt
Aaron Piotrowski 810fb59f66
Improve fiber backtraces
The start/resume/throw execute_data is now attached as the prev_execute_data to the bottom frame of the fiber stack when the fiber is running.
2021-04-30 12:17:50 -05:00

28 lines
520 B
PHP

--TEST--
Backtrace in nested function call
--FILE--
<?php
function suspend_fiber(): void
{
\Fiber::suspend();
throw new Exception;
}
$fiber = new Fiber(function (): void {
suspend_fiber();
});
$fiber->start();
$fiber->resume();
?>
--EXPECTF--
Fatal error: Uncaught Exception in %sbacktrace-nested.php:%d
Stack trace:
#0 %sbacktrace-nested.php(%d): suspend_fiber()
#1 [internal function]: {closure}()
#2 %sbacktrace-nested.php(%d): Fiber->resume()
#3 {main}
thrown in %sbacktrace-nested.php on line %d