php-src/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
Dmitry Stogov ca49e53670 Stop inserting fake frames on VM stack.
Now similar "fake" frames now materialized when fetching debug
backtraces. The patch also fixes few incorrect backtraces for generators
in *.phpt tests.
2021-04-15 15:30:10 +03:00

62 lines
750 B
PHP

--TEST--
ReflectionGenerator::getTrace() over multiple Generators
--FILE--
<?php
function foo() {
yield 1;
yield 2;
}
function bar()
{
yield from foo();
}
function baz()
{
yield from bar();
}
$gen = baz();
$gen->valid();
var_dump((new ReflectionGenerator($gen))->getTrace());
?>
--EXPECTF--
array(3) {
[0]=>
array(4) {
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["function"]=>
string(3) "foo"
["args"]=>
array(0) {
}
}
[1]=>
array(4) {
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["function"]=>
string(3) "bar"
["args"]=>
array(0) {
}
}
[2]=>
array(2) {
["function"]=>
string(3) "baz"
["args"]=>
array(0) {
}
}
}