On Tue, Feb 19, 2013 at 2:25 PM, Derick Rethans <der...@php.net> wrote:

> On Tue, 19 Feb 2013, Nikita Popov wrote:
>
> > This RFC proposes to remove the type-restrictions on Iterator keys
> > used in foreach:
> >
> > https://wiki.php.net/rfc/foreach-non-scalar-keys
> >
> > I took over Levi's RFC and added a patch for it.
>
> Under "Open Questions" you write:
>
> > What should be done with the keys that are valid in the iterator, but
> not in
> > the array? I think the best approach would be to just set the array keys
> with
> > the exact same semantics as PHP would do (i.e. with all casts and
> warnings).
>
> Would __toString be called in case the key was an object?
>

Current behavior of PHP can be found here:
http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_execute.c#996 So if one goes
with that approach, then no, __toString won't be called, it'll throw a "*
Warning*: Illegal offset type" and not set the key. Don't know whether
that's good or bad ^^

Nikita

Reply via email to