Re: RFC proposal
| From: | Rowan Collins | Date: | Fri, 02 Jun 2017 14:33:45 +0000 |
| Subject: | Re: RFC proposal | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-99322@lists.php.net to get a copy of this message | ||
On 2 June 2017 14:21:38 BST, "Bartłomiej Krukowski"
<krukowski.bartlomiej@gmail.com> wrote:
> There is an
>option to
>use variable as implicit reference (@see example -
>http://ideone.com/T6oF7C
><http://ideone.com/T6oF7C>), I think it should not be
>possible. Only
>explicit references should be allowed (except objects).
So in summary: a function given an array (or object) containing items assigned by reference can
unknowingly "leak" its internal processing of that array.
It's certainly an interesting case, but what is the alternative behaviour you would propose?
Just banning all assignment to array items by reference would stop this, but also remove a
potentially useful feature.
Detecting or defeating this situation at the time a function is called might prove expensive in
terms of processing and memory (e.g. unnecessarily cloning values), and the result would be a
compatibility break for anyone using this, so it would require careful consideration.
[Note: the convention on this list is to reply below quoted text, not above, when replying.]
Regards,
--
Rowan Collins
[IMSoP]