php.net |  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
 [2020-05-15 08:47 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-15 08:57 UTC] nikic@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: nikic
 [2020-05-15 08:57 UTC] nikic@php.net
Very likely caused by the fix for bug #78434.
 [2020-05-15 09:05 UTC] nikic@php.net
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
 [2020-05-15 09:05 UTC] nikic@php.net
-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] nikic@php.net
@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: Wed Oct 09 08:01:27 2024 UTC