com php-src: Fix bogus traces with ReflectionGenerator::getTrace(): NEWS Zend/zend_generators.c ext/reflection/tests/ReflectionGen erator_basic.phpt
ext/reflection/tests/ReflectionGenerato r_getTrace.phpt ext/reflection/tests/ReflectionGenerator _in_Generator.phpt

From: Date: Thu, 20 Aug 2015 21:24:28 +0000
Subject: com php-src: Fix bogus traces with ReflectionGenerator::getTrace(): NEWS Zend/zend_generators.c ext/reflection/tests/ReflectionGen erator_basic.phpt
ext/reflection/tests/ReflectionGenerato r_getTrace.phpt ext/reflection/tests/ReflectionGenerator _in_Generator.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88708@lists.php.net to get a copy of this message
Commit: 5ece3ec71c3eb8d3b706c68b82a8f7c4a14491c6 Author: Bob Weinand <bobwei9@hotmail.com> Thu, 20 Aug 2015 23:24:28 +0200 Parents: 29a8981c81a7403070305ab4631c2fa9e858a082 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5ece3ec71c3eb8d3b706c68b82a8f7c4a14491c6 Log: Fix bogus traces with ReflectionGenerator::getTrace() Changed paths: M NEWS M Zend/zend_generators.c M ext/reflection/tests/ReflectionGenerator_basic.phpt A ext/reflection/tests/ReflectionGenerator_getTrace.phpt M ext/reflection/tests/ReflectionGenerator_in_Generator.phpt Diff: diff --git a/NEWS b/NEWS index c82c935..f92f283 100644 --- a/NEWS +++ b/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: diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 0b54292..18c6087 100644 --- a/Zend/zend_generators..c +++ b/Zend/zend_generators.c @@ -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; diff --git a/ext/reflection/tests/ReflectionGenerator_basic.phpt b/ext/reflection/tests/ReflectionGenerator_basic.phpt index 528d2d9..6f35b6c 100644 --- a/ext/reflection/tests/ReflectionGenerator_basic.phpt +++ b/ext/reflection/tests/ReflectionGenerator_basic.phpt @@ -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"]=> diff --git a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt new file mode 100644 index 0000000..05a4600 --- /dev/null +++ b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt @@ -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) { + } + } +} diff --git a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt index 9c0098d..a227e1a 100644 --- a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt +++ b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt @@ -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"]=>

« previous php.cvs (#88708) next »