Re: Unwrap reference after foreach
| From: | Tobias Nyholm | Date: | Fri, 13 Aug 2021 16:14:10 +0000 |
| Subject: | Re: Unwrap reference after foreach | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115709@lists.php.net to get a copy of this message | ||
I’m happy with this too. I’m +1 for most things that makes a smoother developer experience.
//Tobias Nyholm
> On 13 Aug 2021, at 06:44, Hans Henrik Bergan <divinity76@gmail.com> wrote:
>
> +1 from me, and yeah lets not care about that edge case, i hope the edge
> gets removed at some point.. (but that's an issue for another thread)
>
> FWIW if attempts at getting it in 8.2 fails, i would welcome another
> attempt at this for PHP9
>
>
>> On Fri, 13 Aug 2021 at 15:29, Nikita Popov <nikita.ppv@gmail.com> wrote:
>>
>> Hi internals,
>>
>> I'd like to address a common footgun when using foreach by reference:
>> https://wiki.php.net/rfc/foreach_unwrap_ref
>>
>> This addresses the issue described in the big red box at
>>
>> https://www.php.net/manual/en/control-structures.foreach.php. While
>> this
>> is
>> "not a bug" (as our bug tracker can regularly attest), it's rather
>> unexpected, and we could easily avoid it...
>>
>> Regards,
>> Nikita
>>