Bug #79927 [Opn->Csd]: Generator doesn't throw exception after multiple yield from iterable

From: Date: Tue, 11 Aug 2020 13:49:53 +0000
Subject: Bug #79927 [Opn->Csd]: Generator doesn't throw exception after multiple yield from iterable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228513@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79927&edit=1 ID: 79927 Updated by: nikic@php.net Reported by: roxblnfk at yandex dot com Summary: Generator doesn't throw exception after multiple yield from iterable -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: any PHP Version: 7.4.8 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=e25aab64268adb4e233737c274b195e1662f7211 Log: Fixed bug #79927 Previous Comments: ------------------------------------------------------------------------ [2020-08-03 21:14:46] roxblnfk at yandex dot com Description: ------------ A generator that yields values from an array does not throw an exception when calling the rewind method after multiple yields from same yield construction. Can also be seen at https://3v4l.org/NZ77U Test script: --------------- <?php $generator = (static function () { yield from [1,2,3]; })(); $generator->next(); $generator->next(); $generator->rewind(); echo $generator->current(); # 3 Expected result: ---------------- RuntimeException on line $generator->rewind(); Actual result: -------------- 3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79927&edit=1

« previous php.bugs (#228513) next »