Bug #79927 [Csd]: Generator doesn't throw exception after multiple yield from iterable
Edit report at https://bugs.php.net/bug.php?id=79927&edit=1
ID: 79927
Updated by: requinix@php.net
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
-Assigned To:
+Assigned To: requinix
Block user comment: N
Private report: N
New Comment:
That's right. Because it would not be polite if code that already runs in 7.4 suddenly started
throwing exceptions with the next release.
Previous Comments:
------------------------------------------------------------------------
[2020-10-10 21:15:09] roxblnfk at ya dot ru
Do i understand correctly that this bug will not be fixed for php 7?
------------------------------------------------------------------------
[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
Thread (6 messages)