|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-01-09 14:09 UTC] salathe@php.net
[2019-01-09 14:10 UTC] salathe@php.net
-Status: Open
+Status: Duplicate
[2019-01-09 14:10 UTC] salathe@php.net
[2019-01-09 14:41 UTC] jwurtz at jolicode dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Description: ------------ When using iterator_to_array on a function that return a \Generator, if this function use both yield and yield from it will only put values of the yield from expression. Test script: --------------- <?php function yield1() { yield 'foo'; } function yield2() { yield 'bar'; yield from yield1(); } // Will only display foo var_dump(iterator_to_array(yield2())); // will correctly display each value foreach (yield2() as $data) { var_dump($data); } Expected result: ---------------- It should create an array with all values and not only the one from the yield from expression. Actual result: -------------- Create an array only on the yield from expression