# ternary expr/reference bug?

- Thread: https://externals.io/message/275
- Original archive: https://news-web.php.net/php.internals/275
- Started by Daniel Cowgill on 2003-03-25T16:50:00+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #275 — Daniel Cowgill — 2003-03-25T16:50:00+00:00

URL: https://externals.io/message/275#275

Referring to bug #12247 (http://bugs.php.net/bug.php?id=12247):

Is this bug really "bogus"? The argument that the ternary expression should
deep-copy reference values precisely because it's an expression doesn't hold
water: "$x" and "foo()" are expressions. I'm curious whether others have run
across this problem and what they think of it. It strikes me as non-orthogonal
and quite surprising (I can't think of another programming language which
exhibits similar behavior).

---

## #278 — Andi Gutmans — 2003-03-25T20:27:01+00:00

URL: https://externals.io/message/275#278 · In reply to: #275

It's not "really" bogus but it's the way PHP behaves. Don't expect this to 
change.
Basically like the bug report states, references both when returned from 
functions and using the =& operator work only on variables. ?: is 
considered an expression including ++$var and so on...

Andi

At 11:50 AM 3/25/2003 -0500, Daniel Cowgill wrote:
>Referring to bug #12247 (http://bugs.php.net/bug.php?id=12247):
>
>Is this bug really "bogus"? The argument that the ternary expression should
>deep-copy reference values precisely because it's an expression doesn't hold
>water: "$x" and "foo()" are expressions. I'm curious whether others have run
>across this problem and what they think of it. It strikes me as non-orthogonal
>and quite surprising (I can't think of another programming language which
>exhibits similar behavior).
