Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator

[email protected] (Michael Wallner)
Newsgroups php.internals
Message-ID <[email protected]>
On 07/09/14 14:25, Andrea Faulds wrote:
> 
> On 7 Sep 2014, at 13:22, Sherif Ramadan <[email protected]>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.