# [VOTE][RFC] Null Coalesce Operator

- Thread: https://staging.externals.io/message/77356
- Original archive: https://news-web.php.net/php.internals/77356
- Started by Andrea Faulds on 2014-09-19T23:34:58+00:00
- Messages: 6
- RFC: Null Coalesce Operator (Implemented (PHP 7.0)) — https://staging.externals.io/rfc/isset_ternary.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://staging.externals.io/search.md?q={query} · RFCs at https://staging.externals.io/rfc.md · JSON API at https://staging.externals.io/api · documentation at https://staging.externals.io/llms.txt

---

## #77356 — Andrea Faulds — 2014-09-19T23:34:58+00:00

URL: https://staging.externals.io/message/77356#77356

Good evening,

I’ve put the Null Coalesce Operator RFC to a vote:

https://wiki.php.net/rfc/isset_ternary#vote

It is a 2/3 majority vote and ends in a week’s time on 2014-09-27.

For anyone wondering, I’ve decided not to include ??= because we don’t have an assignment operator for ?: either, nor does C# have one, it may be a pain to implement, and I’m not sure we need it.

Thanks!
--
Andrea Faulds
http://ajf.me/

---

## #77370 — Patrick Schaaf — 2014-09-20T07:40:27+00:00

URL: https://staging.externals.io/message/77356#77370 · In reply to: #77356

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?

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.

best regards
  Patrick

---

## #77374 — Nikita Popov — 2014-09-20T10:31:15+00:00

URL: https://staging.externals.io/message/77356#77374 · In reply to: #77370

> Am 20.09.2014 01:35 schrieb "Andrea Faulds" <ajf@ajf.me>:
> > […]
>
> 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

---

## #77455 — Derick Rethans — 2014-09-22T11:31:03+00:00

URL: https://staging.externals.io/message/77356#77455 · In reply to: #77370

> Am 20.09.2014 01:35 schrieb "Andrea Faulds" <ajf@ajf.me>:
> > […]
> 
> 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)

It should be this one to be consistent. @ is shit, but sadly can not be 
avoided in all situations.

cheers,
Derick

---

## #77668 — Dmitry Stogov — 2014-09-26T11:55:51+00:00

URL: https://staging.externals.io/message/77356#77668 · In reply to: #77455

looks like Perl magic :(

-1

Dmitry.





> 
>
> > […]
> of
> > […]
> like
> > […]
>
> It should be this one to be consistent. @ is shit, but sadly can not be
> avoided in all situations.
>
> cheers,
> Derick

---

## #77687 — Andrea Faulds — 2014-09-27T15:17:30+00:00

URL: https://staging.externals.io/message/77356#77687 · In reply to: #77356

> 
> 
> I’ve put the Null Coalesce Operator RFC to a vote:
> 
> https://wiki.php.net/rfc/isset_ternary#vote
> 
> It is a 2/3 majority vote and ends in a week’s time on 2014-09-27.

By 31 votes to 3, the RFC has passed and voting has now closed. If there are no objections, I'll merge the patch sometime soon and work on a specification patch.
--
Andrea Faulds
http://ajf.me/
