|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-11-24 20:56 UTC] requinix@php.net
[2015-11-24 21:14 UTC] srice at fb dot com
[2015-11-24 22:55 UTC] bwoebi@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: bwoebi
[2015-11-24 22:55 UTC] bwoebi@php.net
[2015-11-24 23:11 UTC] srice at fb dot com
[2015-11-24 23:14 UTC] bwoebi@php.net
-Status: Closed
+Status: Verified
[2015-11-24 23:14 UTC] bwoebi@php.net
[2015-11-25 08:55 UTC] bwoebi@php.net
[2015-11-25 08:55 UTC] bwoebi@php.net
-Status: Verified
+Status: Closed
[2015-11-25 08:56 UTC] bwoebi@php.net
[2016-07-20 11:35 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 20:00:01 2025 UTC |
Description: ------------ When two separate generator instances `yield from` a common iterator the second element of the iterator gets skipped. There is a test case to keep this from happening with a common shared generator (and the fix keeps track of which generator is priming or not) but it doesnt work with iterators. See the sample script below (which is mostly just a small change to the `multiple_yield_from_on_same_generator` test that already exists). Test script: --------------- <?php function it() { yield from [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; } function bar($g) { yield from $g; } $gen = it(); $gens[] = bar($gen); $gens[] = bar($gen); do { foreach($gens as $g) { var_dump($g->current()); $gen->next(); } } while ($gen->valid()); Expected result: ---------------- int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) Actual result: -------------- int(1) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) NULL