|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-11-13 01:55 UTC] laruence@php.net
-Assigned To:
+Assigned To: nikic
[2015-11-13 02:37 UTC] pollita@php.net
-Package: PHP Language Specification
+Package: Scripting Engine problem
[2015-11-13 17:12 UTC] nikic@php.net
-Assigned To: nikic
+Assigned To: bwoebi
[2015-11-24 22:44 UTC] bwoebi@php.net
[2015-11-24 22:44 UTC] bwoebi@php.net
-Status: Assigned
+Status: Closed
[2015-11-24 22:44 UTC] bwoebi@php.net
[2016-07-20 11:35 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 22:00:01 2025 UTC |
Description: ------------ The current implementation of the valid method doesnt properly take into account the possibility that the inner generator could be executed outside of the context of the outer generator. In this case, its saying that the outer generator isnt valid because the inner generator isnt valid, but in fact the outer generator still has more to execute. Test script: --------------- <?php function g1() { yield 1; yield 2; } function g2($g1) { yield from $g1; echo "!\n"; yield 3; } $g1 = g1(); $g2 = g2($g1); while ($g2->valid()) { var_dump($g2->current()); $g1->next(); } Expected result: ---------------- I would expect the following: int(1) int(2) NULL NULL NULL ...(infinite loop) I say this because g2 got primed to the yield from statement, so it should be returning for current whatever g1 is returning for current. For a finished generator, this would be NULL. Actual result: -------------- int(1) int(2)