Bug #79927 [NEW]: Generator doesn't throw exception after multiple yield from iterable
From: roxblnfk at yandex dot com
Operating system: any
PHP version: 7.4.8
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Generator doesn't throw exception after multiple yield from iterable
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 bug report at https://bugs.php.net/bug.php?id=79927&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79927&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79927&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79927&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79927&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79927&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79927&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79927&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79927&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79927&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79927&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79927&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79927&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79927&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79927&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79927&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79927&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79927&r=mysqlcfg
Thread (6 messages)
- roxblnfk at yandex dot com