php-src/Zend/tests/fibers/backtrace-object.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
524 B
PHP

--TEST--
Backtrace in with object as fiber callback
--FILE--
<?php
class Test
{
public function __invoke(string $arg): void
{
Fiber::suspend();
throw new Exception($arg);
}
}
$fiber = new Fiber(new Test);
$fiber->start('test');
$fiber->resume();
?>
--EXPECTF--
Fatal error: Uncaught Exception: test in %sbacktrace-object.php:%d
Stack trace:
#0 [internal function]: Test->__invoke('test')
#1 %sbacktrace-object.php(%d): Fiber->resume()
#2 {main}
thrown in %sbacktrace-object.php on line %d