|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79600 Regression in 7.4.6 when yielding an array based generator
Submitted: 2020-05-15 08:47 UTC Modified: 2020-05-19 10:07 UTC
From: pvandommelen at gmail dot com Assigned: nikic (profile)
Status: Closed Package: *General Issues
PHP Version: 7.4.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
19 + 9 = ?
Subscribe to this entry?

 [2020-05-15 08:47 UTC] pvandommelen at gmail dot com
Also see the test script. When yielding a generator which is based on an array, the first element is returned twice.

Test script:

function createArrayGenerator() {
    yield from [

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-15 08:57 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: nikic
 [2020-05-15 08:57 UTC]
Very likely caused by the fix for bug #78434.
 [2020-05-15 09:05 UTC]
Automatic comment on behalf of
Log: Fixed bug #79600
 [2020-05-15 09:05 UTC]
-Status: Assigned +Status: Closed
 [2020-05-19 10:05 UTC] rob dot bast at gmail dot com
Does closed mean this will be fixed in the next patch release? Cause I am also running into this issue with 7.4.6 at a client. We pinned our version to 7.4.5 for now.
 [2020-05-19 10:07 UTC]
@rob dot bast at gmail dot com: Yes, it will be fixed in the next patch release.

Sorry for the trouble, it was a really stupid mistake, and somehow we did not have test coverage for such a simple case.
 [2020-05-20 08:58 UTC] joshuahugh94 at gmail dot com
Is there a release schedule for the patch?

Apologies if this is the wrong place to ask, I cannot find release information anyway.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 17:01:30 2024 UTC