Re: [VOTE] Generators
| From: | Nikita Popov | Date: | Wed, 29 Aug 2012 18:52:57 +0000 |
| Subject: | Re: [VOTE] Generators | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62582@lists.php.net to get a copy of this message | ||
On Wed, Aug 29, 2012 at 6:21 PM, Jared Williams
<jared.williams1@ntlworld.com> wrote:
>
>
>> -----Original Message-----
>> From: Nikita Popov [mailto:nikita.ppv@gmail.com]
>> Sent: 25 August 2012 17:11
>> To: PHP internals
>> Subject: [PHP-DEV] [VOTE] Generators
>>
>> Hi internals!
>>
>> I think the generators RFC has been discussed thoroughly
>> enough by now, so I opened the vote:
>>
>> https://wiki.php.net/rfc/generators#vote
>>
>> Thanks,
>> Nikita
>>
>
> Hi,
> Just discovered another seg fault.
> When iterating over a generator that returns references twice it
> causes a seg fault.
>
> function &bind(array $keys, array &$row)
> {
> foreach($keys as $key)
> yield $key => $row[$key];
> }
>
> $row = [];
> $it = bind(['a', 'b'], $row);
>
> foreach($it as $key => &$ref)
> echo $key;
> echo "\n";
> foreach($it as $key => &$ref)
> echo $key;
Thanks, this is now fixed. It'll throw an exception now, saying that
you can't traverse an already closed generator.
Nikita