mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Fix bogus traces with ReflectionGenerator::getTrace()
This commit is contained in:
parent
29a8981c81
commit
5ece3ec71c
3
NEWS
3
NEWS
@ -17,6 +17,9 @@ PHP NEWS
|
||||
- Standard:
|
||||
. Fixed bug #70295 (Segmentation fault with setrawcookie). (Bob)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug causing bogus traces for ReflectionGenerator::getTrace(). (Bob)
|
||||
|
||||
20 Aug 2015, PHP 7.0.0 RC 1
|
||||
|
||||
- Core:
|
||||
|
@ -273,7 +273,7 @@ static ZEND_COLD zend_function *zend_generator_get_constructor(zend_object *obje
|
||||
|
||||
ZEND_API zend_execute_data *zend_generator_check_placeholder_frame(zend_execute_data *ptr)
|
||||
{
|
||||
if (!ptr->func && ptr->prev_execute_data && Z_OBJ(ptr->This)) {
|
||||
if (!ptr->func && Z_OBJ(ptr->This)) {
|
||||
if (Z_OBJCE(ptr->This) == zend_ce_generator) {
|
||||
zend_generator *generator = (zend_generator *) Z_OBJ(ptr->This);
|
||||
zend_generator *root = (generator->node.children < 1 ? generator : generator->node.ptr.leaf)->node.ptr.root;
|
||||
|
@ -39,7 +39,11 @@ object(Generator)#2 (0) {
|
||||
}
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(%d)
|
||||
["function"]=>
|
||||
string(3) "foo"
|
||||
["args"]=>
|
||||
|
53
ext/reflection/tests/ReflectionGenerator_getTrace.phpt
Normal file
53
ext/reflection/tests/ReflectionGenerator_getTrace.phpt
Normal file
@ -0,0 +1,53 @@
|
||||
--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(2) {
|
||||
[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) {
|
||||
}
|
||||
}
|
||||
}
|
@ -46,7 +46,11 @@ object(ReflectionFunction)#4 (1) {
|
||||
NULL
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(2) {
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(%d) "%s"
|
||||
["line"]=>
|
||||
int(%d)
|
||||
["function"]=>
|
||||
string(9) "{closure}"
|
||||
["args"]=>
|
||||
|
Loading…
Reference in New Issue
Block a user