Bug #79600 [Com]: Regression in 7.4.6 when yielding an array based generator

From: Date: Wed, 20 May 2020 08:58:02 +0000
Subject: Bug #79600 [Com]: 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-227088@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
 Comment by:         joshuahugh94 at gmail dot com
 Reported by:        pvandommelen at gmail dot com
 Summary:            Regression in 7.4.6 when yielding an array based
                     generator
 Status:             Closed
 Type:               Bug
 Package:            *General Issues
 PHP Version:        7.4.6
 Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Is there a release schedule for the patch?


Apologies if this is the wrong place to ask, I cannot find release information anyway.


Previous Comments:
------------------------------------------------------------------------
[2020-05-19 10:07:40] 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-19 10:05:10] 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-15 09:05:19] 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 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


Thread (6 messages)

« previous php.bugs (#227088) next »