queryExecute try/catch changes output within cfimported tags

Description

I have an application where the display is built using cfimport.

On one page I have a name lookup which shows some text. It's possible that the datasource does not exist, so I try catch the query and return a failed to fetch string when it errors.

There is a problem that when queryExecute is try/catched it re-writes or jumbles up the output.

Attached is an app that shows the problem. When it does not error it should show 'Hello World' then an ordered list. If the code runs with a try/catched queryExecute then the 'Hello World' appears at the bottom of the page with broken HTML.

So far, I can only replicate this with queryExecute. If you replace that line with a throw; or 1/0 then the try/catch and output operates as normal.

If the cfimport tags are replaced with normal cfinclude calls then the page displays as normal.

It just appears to be queryExecute when try/catched within cfimport tags (an open and closing tag)

Environment

lucee 5.2.2.71 running in a debian docker container fronted by nginx

Attachments

5
  • 09 Aug 2017, 11:06 am
  • 09 Aug 2017, 11:06 am
  • 09 Aug 2017, 11:06 am
  • 09 Aug 2017, 11:06 am
  • 08 Aug 2017, 05:01 pm

Activity

Show:

Pothys - MitrahSoft 9 August 2017 at 11:11

I've analyzed this ticket & confirmed the issue happened in latest version of 5.2.3.31-RC. In queryExecute changes the output with cfimport tags while values comes from try/catch. It breaking output while it comes from catch value.

Step1:

cfimport tag without any error.

function getName () { try { return queryExecute("select TOP 1 TITLE from name", [], {datasource="bloggers"}).title; } catch (Any e) { return "Going Error - " & e.message; } } <cfimport taglib="tags" prefix="site"> <site:shell> <cfoutput> <p>Hello World</p> <ul> <!--- <cfloop from=1 to=2 index="i"> <li>#i# - #getNameOldStyle()#</li> </cfloop> ---> </ul> </cfoutput> </site:shell>

Output
OutPut1

step2:

Error before query execute function

function getName () { try { local.Foo = 1/0; return queryExecute("select TOP 1 TITLE from name", [], {datasource="bloggers"}).title; } catch (Any e) { return "Going Error - " & e.message; } }

output
OutPut2

Step3:

Error on queryExecute function breaks

function getName () { try { //datasouce doesn't exist error return queryExecute("select TOP 1 TITLE from name", [], {datasource="test"}).title; } catch (Any e) { return "Going Error - " & e.message; } }

// it breaks Output
output
OutPut3

Step4:

Without QueryExecute Method

function getName () { try { //datasouce doesn't exist error local.qry = new Query(); local.qry.setDatasource("tester"); local.qry.setSQL("select TOP 1 TITLE from Posts"); return local.qry.execute().getResult().title; } catch (Any e) { return "Lindsay Lohan Old Style - " & e.message; } }

OutPut

OutPut4

Jedihomer Townend 8 August 2017 at 17:08

I've run the updater and updated to 5.2.3.31-RC and this issue still exists.

Details

Assignee

Reporter

Priority

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 8 August 2017 at 17:01
Updated 14 August 2017 at 20:18