tracker issue : CF-4204686

select a category, or use search below
(searches all categories and all time range)
Title:

Ternary Operator is not interpreting the correct way

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Ashwini A. / ()

Created: 06/27/2019

Components: Language, Functions

Versions: 2018

Failure Type: Crash

Found In Build/Fixed In Build: 2018.0.04.314546 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Win 2016

Vote Count: 0

Problem Description:
When the ternary operator is used and the true value or a false value is a constant with a decimal like 0.1 or 2.1 etc, then we get weird error
method: runPage signature: ()Ljava/lang/Object;) Expecting to find object/array on stack null <br>The error occurred on line -1
This happens only in the production profile

<cfset a=0>
<cfset result = a ? 1.2 : 2.4>

Steps to Reproduce:
Just run the above script

Actual Result:
runPage signature: ()Ljava/lang/Object;) Unable to pop operand off an empty stack null <br>The error occurred on line -1

Expected Result:
 1.2 if condition is true, else 2.4

Any Workarounds:
Yes, 
one solution
<cfset a=0>
<cfset x=1.2>
<cfset y=2.4>
<cfset result=a ? x : y>

Or the regular <cfif> Block works.
If the constants did not have the decimal point it works fine. Analysing this i feel that the application is trying to interpret part of the data, thinking that it is an operator

I found this out by process of elimination. If only the error was little descriptive, that would have been easy.

If there are  no decimal point it works fine, with the constant values

<cfset a=0>

<cfset result=a ? 2 : 4>

Notes: We upgraded from 2016-CF2018. This is major issue for me, because i have to sweep the whole code base to look for the usage of this. I upgraded to CF2018  in DEV and staging, We did not come across this there.

Attachments:

Comments: