?: bug with false

Description

result = false ?: "default";

Expected:
default

Actual:

Lucee 5.0.0.49 Error (template) Message left operant of the Elvis operator has to be a variable or a function call Stacktrace The Error Occurred in C:\apps\lucee\5\express\webapps\ROOT\shared\cfml\language\operators\elvis\falseNull.cfm: line 4 2: // falseNull.cfm 3: 4: result = false ?: "default"; 5: 6: </cfscript>

The left operanD (note spelling) should be a boolean expression. It does not need to be "a variable or a function call".

Environment

None

Attachments

1

Activity

Former user 
24 November 2016 at 09:11

This ticket is closed, it has been deployed, it has been put into release notes

I will raise a new ticket, make the commits, PR, job done. Why so attached to this ticket number specifically?

At the time of fixing, I could not fix 5 as I could not compile it at the time and we didn't have the automated testing we now do as that was in progress.

Adam Cameron 
24 November 2016 at 09:07

If it was raised as affecting 4 & 5, then only fixing it in 4 does not "resolve" the issue. It resolves half the issue.

You already have a ticket here: why do you need a new one? Just reopen this one and to the rest of the outstanding work?

That is not to diminish yer efforts fixing it in 4.x, I just think the fix did not meet the implied acceptance criteria for the ticket, so it never should have been marked as resolved in the first place.

Former user 
24 November 2016 at 08:53

I did fix it on 4.x - see the commits, whether or not they have been removed I can't tell but this was definitely resolved.

Will raise a ticket for 5.

Adam Cameron 
23 November 2016 at 19:39

This is still broken in 5.1.0.34:

Lucee 5.1.0.34 Error (template) Message left operant of the Elvis operator has to be a variable or a function call Stacktrace The Error Occurred in C:\apps\lucee\5.0\express\webapps\ROOT\cfml\community\puzzle\scratch.cfm: line 2 1: <cfscript> 2: s = false ?: "default"; 3: 4: writeOutput(s);

Repro:
http://trycf.com/gist/750ad176e30db28671810e872e1cc7a3/lucee5?theme=monokai

<cfscript> s = false ?: "default"; writeOutput(s); </cfscript>

On CF, this returns "default" which is what I'd expect.

NB: trycf.com isn't 5.1.0.34, but my home machine that I ran into this on is that version. The error output above comes from there.

Also: not sure why this is closed as "fixed" given it's broken on 4.x and 5.x and you only even claim to have fixed it for 4.x..?

Adam Cameron 
7 December 2015 at 10:55

Don't forget to also fix the spelling mistake of "operant" (should be "operand") in the (potential) error message. best check this throughout, rather than just this one instance too, I guess.

Fixed

Details

Assignee

Reporter

Priority

Labels

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 30 July 2015 at 07:56
Updated 17 March 2021 at 12:01
Resolved 7 December 2015 at 10:45