Bug #79927 [Com]: Generator doesn't throw exception after multiple yield from iterable

From: Date: Sat, 10 Oct 2020 21:15:09 +0000
Subject: Bug #79927 [Com]: Generator doesn't throw exception after multiple yield from iterable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229516@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 Comment by: roxblnfk at ya dot ru Reported by: roxblnfk at yandex dot com Summary: Generator doesn't throw exception after multiple yield from iterable 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: Do i understand correctly that this bug will not be fixed for php 7? Previous Comments: ------------------------------------------------------------------------ [2020-08-11 13:49:53] nikic@php.net 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 ------------------------------------------------------------------------ [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 (#229516) next »