Re: [VOTE][RFC] Null Coalesce Operator

From: Date: Sat, 20 Sep 2014 10:31:15 +0000
Subject: Re: [VOTE][RFC] Null Coalesce Operator
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-77374@lists.php.net to get a copy of this message
On Sat, Sep 20, 2014 at 9:40 AM, Patrick Schaaf <php@bof.de> wrote: > Am 20.09.2014 01:35 schrieb "Andrea Faulds" <ajf@ajf.me>: > > > > https://wiki.php.net/rfc/isset_ternary#vote > > Hi, > > got a question after being bitten my the issue yesterday in the context of > the "@yadda ?: 'default'" form yesterday: > > What about yadda that results, at the moment, in fatal errors?? Things like > static::$missingproperty, $this->missingmethod(), and other stuff? > > Will the ?? operator > A) make these non-fatal > B) silently fatal (like now when @ is used) > C) loudly fatal (like when no @ is used) > D) depends on what fatal it is? > $this->missingmethod() ?? null will continue to be (loudly) fatal (or recoverable fatal, once a recent RFC is merged). static::$missingproperty ?? null will not throw an error, as it is subject to isset(). > To me the most annoying case here, not only in relation to ?? of course, is > the different behaviour of $this->missingproperty and > someclass::$missingproperty, with the latter being fatal, but easily > provocable by a call to unset(someclass::$missingproperty earlier in the > code. > It's not possible to unset a static property, see http://3v4l.org/PkD36. Which is probably also why accessing an undefined static property is fatal as well ;) Nikita

« previous php.internals (#77374) next »