On Sat, Jul 21, 2012 at 6:31 PM, Jared Williams
<jared.willia...@ntlworld.com> wrote:
> Can't yield a reference to an array item directly.
>
> Eg.
>
> function &map(array &$row)
> {
>      yield $row[0];
> }

Thanks, this is fixed now.

> Also seems to be a problem with iterating
>
> foreach(map($row) as &$value)
>
> cannot be done without a fatal error
>
> $i = map($row);
> foreach($i as &$value)
>
> however works.

This was an old foreach restriction that never really made sense and
makes even less sense once generators are in. So I dropped it. Now
everything can be iterated by-reference.

> Seems relatively easy to trigger a infinite loop atm.
>
> Typo'd a SQL table name which caused an exception within PDO inside a
> generator function, which then caused an infinite loop.

I forgot to rethrow the exception in the foreach scope. Should be fixed now.

Thanks for your feedback!

Nikita

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to