Bug #79614 [Opn->Dup]: Nested 'yield from' duplicate first element

From: Date: Wed, 20 May 2020 07:17:02 +0000
Subject: Bug #79614 [Opn->Dup]: Nested 'yield from' duplicate first element
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227087@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79614&edit=1 ID: 79614 Updated by: cmb@php.net Reported by: ponomarev at gmail dot com Summary: Nested 'yield from' duplicate first element -Status: Open +Status: Duplicate Type: Bug -Package: *General Issues +Package: Scripting Engine problem PHP Version: 7.4.6 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Well, actually a duplicate of that bug. Previous Comments: ------------------------------------------------------------------------ [2020-05-20 02:42:47] requinix@php.net No doubt related to bug #78434. ------------------------------------------------------------------------ [2020-05-20 02:22:18] ponomarev at gmail dot com Description: ------------ See the example script. First element yielded twice if iterate over a generator that yield from another generator. Test script: --------------- https://3v4l.org/2ZQ8d <?php $arr = [1,2,3]; function a($x){ yield from $x; } foreach(a(a($arr)) as $x){ print_r($x); } Expected result: ---------------- 123 Actual result: -------------- 1123 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79614&edit=1

« previous php.bugs (#227087) next »