Bug #79600 [Asn->Csd]: Regression in 7.4.6 when yielding an array based generator
| From: | nikic@php.net | Date: | Fri, 15 May 2020 09:05:19 +0000 |
| Subject: | Bug #79600 [Asn->Csd]: Regression in 7.4.6 when yielding an array based generator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227048@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79600&edit=1
ID: 79600
Updated by: nikic@php.net
Reported by: pvandommelen at gmail dot com
Summary: Regression in 7.4.6 when yielding an array based
generator
-Status: Assigned
+Status: Closed
Type: Bug
Package: *General Issues
PHP Version: 7.4.6
Assigned To: nikic
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=d87b0685b5ec4e5df6d732414653f343bc44af8c
Log: Fixed bug #79600
Previous Comments:
------------------------------------------------------------------------
[2020-05-15 08:57:57] nikic@php.net
Very likely caused by the fix for bug #78434.
------------------------------------------------------------------------
[2020-05-15 08:47:28] pvandommelen at gmail dot com
Description:
------------
Also see the test script. When yielding a generator which is based on an array, the first element is
returned twice.
Test script:
---------------
// https://3v4l.org/gYB16
function createArrayGenerator() {
yield from [
1,
2,
];
}
function createGeneratorFromArrayGenerator() {
yield from createArrayGenerator();
}
foreach (createGeneratorFromArrayGenerator() as $value) {
echo $value;
}
Expected result:
----------------
The entries 1 and 2
Actual result:
--------------
The first entry twice, then the second
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79600&edit=1