tracker issue : CF-4203996

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

Error when using ternary conditional operator inside of <cfdocumentsection>

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Jonathan C. / ()

Created: 01/30/2019

Components: Language

Versions: 2018

Failure Type: Non Functioning

Found In Build/Fixed In Build: 2018.0.2-beta.2 / CF 2018 U5

Priority/Frequency: Critical / All users will encounter

Locale/System: ALL / Linux

Vote Count: 3

Problem Description:

A low-level error is thrown when using a terniary conditional inside of a <cfdocumentsection> tag.

Steps to Reproduce:
{code:java}
<cfdocument format="PDF">
    <h1>Hello World</h1>
    <cfdocumentsection>
        <h2>Hello Section</h2>
        <cfdocumentsection marginBottom="#arrayContains( [ 'pdf' ], 'pdf' ) ? 1.6 : 1#">
            <h2>Hello Sub-Section</h2>
         </cfdocumentsection>
</cfdocumentsection>
</cfdocument>
{code}


Actual Result:

An low-level 500 error is generated by the compiler:

```
(class: cfreport2ecfm1389601345, method: _factor7 signature: (Ljavax/servlet/jsp/tagext/Tag;Ljavax/servlet/jsp/JspWriter;)Ljava/lang/Object;) Expecting to find double on stack
```

Expected Result:

A PDF is generated and rendered

Any Workarounds:

Attachments:

Comments:

A workaround is to use a <cfif> block to set the variable and then pass it in to the document section attribute
Comment by Jonathan C.
30159 | January 30, 2019 12:58:32 AM GMT
Hi Adobe, The issue is much bigger. Here is a repro: <cfscript> foo = true; bar = foo ? 1.2 : 2;//HTTP Error 500.0 - (class: cfmypage2ecfm1301256636, method: runPage signature: ()Ljava/lang/Object;) Unable to pop operand off an empty stack writeOutput(bar); </cfscript> What!? Verified in CF2018 Final (build 2018.0.0.310739) on Windows 10 w/ IIS. Thanks!, -Aaron
Comment by Aaron N.
30167 | February 01, 2019 10:21:34 AM GMT
+1 - Filed as CF-4203999
Vote by Aaron N.
30177 | February 02, 2019 04:46:08 AM GMT
Code to repro : {code:java} <cfset mystruct.test=true> <cfset a=mystruct.test ? 1.6 : 1> <cfoutput>#a#</cfoutput> This throws exception. The following code throws exception: <cfset mystruct.test=true> <cfset a=mystruct.test ? "1.6" : 1> <cfoutput>#a#</cfoutput> {code}  
Comment by Suchika S.
30230 | February 11, 2019 07:30:23 AM GMT
Hi Adobe, I see you've marked this ToFix. However, CF-4203999 is a more complete description of the issue. Thanks!, -Aaron
Comment by Aaron N.
30222 | February 11, 2019 08:17:29 AM GMT
Hi Suchika, Thank you very much for working on this issue. At the moment when I added my previous comment, I did not notice your comment for some reason. But, of course that is okay - I see you know very clearly what the issue is :) Also, I added a comment on CF-4203999 regarding the ticket's title (for the upcoming "Issues Fixed" list). I hope Adobe chooses a title which better summarizes the issue, since the issue is not specific to cfdocumentsection. Thanks!, -Aaron
Comment by Aaron N.
30231 | February 12, 2019 09:42:17 AM GMT
This issue is HUGE. It breaks ternary operators for all double data types. Here is the easiest reproduction: <cfset x = (true ? 0.0 : 0.0)> This will cause the following error: (class: cftest2ecfm1733740874, method: runPage signature: ()Ljava/lang/Object;) Unable to pop operand off an empty stack
Vote by Roland C.
30755 | May 16, 2019 07:09:15 PM GMT
This issue is HUGE. It breaks ternary operators for all double data types. Here is the easiest reproduction: 1. Create a file named test.cfm 2. Paste this single line of code in it: <cfset x = (true ? 0.0 : 0.0)> 3. Execute test.cfm This will cause the following error: (class: cftest2ecfm1733740874, method: runPage signature: ()Ljava/lang/Object;) Unable to pop operand off an empty stack. I'm flummoxed as to how this issue isn't being reported more broadly. Literally any usage of a Double data type in a ternary operation breaks.
Comment by Roland C.
30754 | May 16, 2019 07:13:46 PM GMT
This is still unfixed 8 months later! A language primitive is broken, and nothing is being done about it. This product team is absurd with its priorities.
Comment by Roland C.
31278 | September 04, 2019 02:44:44 PM GMT
This bug is fixed in the latest update of ColdFusion 2018 i.e ColdFusion 2018 Update 5.
Comment by Suchika S.
31392 | September 25, 2019 08:27:45 PM GMT