Title:
The product of listLast(x) and listFirst(x) changes in the context of cfquery and outside the context of cfquery
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/AsDesigned
Reporter/Name(from Bugbase): Stephen Johnson / Stephen Johnson (Stephen Johnson)
Created: 05/11/2015
Components: Language
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Win 2012 Server x64
Vote Count: 0
Problem Description: My expectation is that listFirst() and listLast() should behave like a static idempotent subroutine. And yet both listLast(x) and listFirst(x) produce different results depending on whether those functions exist inside a cfquery and outside a cfquery. Assume these functions are called within a cfquery. If the input (x) into either function contains a single quote, the product will include 2 single quotes. This problem exists in CF9, CF10, and CF 11. And no, this side effect is not a feature, it's a major bug.
Steps to Reproduce:
<b>Outside cfquery:</b><br>
<cfset company = "'I'BM'">
<cfset thisisright = ListFirst(company)>
<cfset thisisreallyright = ListLast(company)>
<cfoutput>#thisisright#</cfoutput><br>
<cfoutput>#thisisreallyright#</cfoutput>
<br><br>
<b>Inside cfquery:</b><br>
<cfquery name="qtest" datasource="webd">
select * from dual where 1 = 2
<cfset thisaintright = ListFirst(company)>
<cfset thisreallyaintright = ListLast(company)>
</cfquery>
<cfoutput>#thisaintright#</cfoutput><br>
<cfoutput>#thisreallyaintright#</cfoutput>
Actual Result:
Outside cfquery:
'I'BM'
'I'BM'
Inside cfquery:
''I''BM''
''I''BM''
Expected Result:
Outside cfquery:
'I'BM'
'I'BM'
Inside cfquery:
'I'BM'
'I'BM'
Any Workarounds:
Don't use listLast() and listFirst().
Stephen Johnson
Adobe Advanced ColdFusion Certified Developer (ADB184437)
Mentor Graphics Inc.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3985498
External Customer Info:
External Company:
External Customer Name: Stephen
External Customer Email:
External Test Config: Confirmed on Windows 7, ColdFusion 9,0,1,274733
and Windows Server 2012, ColdFusion 11,0,03,292480
Oracle 11g
Attachments:
Comments: