ternary expr/reference bug?

php.internals

Daniel Cowgill

23 years ago
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).

Andi Gutmans

23 years ago
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: