Discrepancy with ACF in handling single quotes in cfquery

We are testing whether we can migrate from ACF to Lucee, and ran into an issue in a cfquery and discrepancy in how the two servers handle single quotes.

Here’s sample code. Added to display the content of the query:

   #rcp#
   #Mid(rcp, 1, 1)#
   #Mid(rcp, 2, 1)#
   #Mid(rcp, 3, 1)#
   

ACF results:

''HelloWorld'' 
' 
' 
H

Lucee results:

''HelloWorld''
''
H
e

Of course, this is not a real query, but it shows the problem. The Mid function in Luccee and CF are one character off because of the single quotes in the string and because this is inside a cfquery.

@RCampus, I made a test for this. The mid function doesn’t reproduce as you said. Both ACF and lucee returns the same result. Could you please make sure again?

Thanks for testing. Are you using the same exact code that I posted up there, including cfquery? Can you post the results here by a chance?

Oh, wait. Sorry, my first post is missing cf tags (removed by the online editor). Here is the test code again:

<cfquery dbtype="query">
   <cfset rcp = "'HelloWorld'">
   <pre>
   #rcp#
   #Mid(rcp, 1, 1)#
   #Mid(rcp, 2, 1)#
   #Mid(rcp, 3, 1)#
   </pre>
   <cfabort>
</cfquery>   

does it also happen if you use cfqueryparam around the expression? i.e #Mid(rcp, 1, 1)#