Re: [RFC] Implicit isset() in Shorthand Ternary Operator
| From: | Michael Wallner | Date: | Mon, 08 Sep 2014 08:06:35 +0000 |
| Subject: | Re: [RFC] Implicit isset() in Shorthand Ternary Operator | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77098@lists.php.net to get a copy of this message | ||
On 07/09/14 14:25, Andrea Faulds wrote:
>
> On 7 Sep 2014, at 13:22, Sherif Ramadan <theanomaly.is@gmail.com>
> wrote:
>
>> I've played around with this branch for a bit and seems reasonable,
>> passes the tests, and doesn't seem to have any serious
>> issues/memories leaks AFAICT.
>
> There’s actually a quite serious issue just now, which is that it
> evaluates the first operand twice if it’s not empty. This is because
> $a ?: $b is expanded to empty($a) ? $b : $a, such that if you did
> something which mutates state in there, it’d happen twice. This is
> obviously not good, and I’m going to figure out how to fix this.
>
This could very well be the reason why it is like it is today.
--
Regards,
Mike