|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-05-21 10:37 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
[2020-05-21 10:37 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 12:00:01 2025 UTC |
Description: ------------ Since php 7.4.6, When nesting several `yield from`, the `\Generator::valid` methods return true while the Generator stay open after the last item. (calling `Generator::valid` return once true after the last item. Test script: --------------- <?php function foo() { yield from ['foo', 'bar']; } function bar() { yield from foo(); } function countGenerator($generator) { for ($count = 0; $generator->valid(); $generator->next()) { ++$count; } return $count; } var_dump(countGenerator(foo())); var_dump(countGenerator(bar())); Expected result: ---------------- int(2) int(2) Actual result: -------------- int(2) int(3)