Uploaded image for project: 'Railo'
  1. Railo
  2. RAILO-941

nested <cfoutput>s with query attribute produces incorrect output

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.2.1.000
    • Fix Version/s: 3.2.0.002
    • Labels:
    • Steps to Reproduce:
      Hide

      Run code in bug description

      Show
      Run code in bug description

      Description

      The best way to describe this is with a simple piece of code. The first <cfoutput query="q"> loop produces incorrect output because of the <cfoutput> tag inside the loop. The second <cfoutput query="q"> is exactly the same except it doesn't have the inner (and unnecessary cfoutput). The output should be the same but is different (see further below). This is really only an issue for sloppy programmers and the workaround is easy (remove the nested cfoutput tag).

      <cfset q = queryNew("id") />
      <cfset queryAddRow(q) />
      <cfset querySetCell(q,"id","a") />
      <cfset queryAddRow(q) />
      <cfset querySetCell(q,"id","b") />
      <cfset queryAddRow(q) />
      <cfset querySetCell(q,"id","c") />
      <cfset arr = Arraynew(1) />
      Example with nested cfoutput:<br />
      <cfoutput query="q">
      #q.currentRow#(
      <cfloop list="1,2,3,4,5,6,7,8" index="i">
      <cfoutput>#q.id#</cfoutput> <!--- Nested cfoutput--->
      </cfloop>
      )#q.currentRow#<br />
      </cfoutput>

      <br />
      Example without nested cfoutput:<br />
      <cfoutput query="q">
      #q.currentRow#(
      <cfloop list="1,2,3,4,5,6,7,8" index="i">
      #q.id# <!--- no nested cfoutput--->
      </cfloop>
      )#q.currentRow#<br />
      </cfoutput>

      Here is the output of the code executed.

      Example with nested cfoutput:
      1( abc abc abc abc abc abc abc abc )3
      2( bc bc bc bc bc bc bc bc )3
      3( c c c c c c c c )3

      Example without nested cfoutput:
      1( a a a a a a a a )1
      2( b b b b b b b b )2
      3( c c c c c c c c )3

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                micstriit Michael Offner
                Reporter:
                clitnak Colby Litnak
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: