Lucee Version: 6.2.3.35 (Gelert)
Component: Debug / Classic.cfc
Not reproducible in: Lucee 7.x
Summary
The Classic debug template throws an “Array index out of range” error when displaying query parameters that contain comma-separated values. The actual query executes successfully, but the debug output fails to render.
Steps to Reproduce
- Enable Classic debug template in Lucee Admin
- Create a simple CFM file with the following code:
<cfquery name="qqq" datasource="myDatasource">
INSERT INTO TestTable (FieldName)
VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="1111,222,333">);
</cfquery>
- Execute the page
Expected Behavior
Debug output should display:
#1 Parameter(CF_SQL_VARCHAR) = 1111,222,333
Actual Behavior
Error is thrown:
Array index [2] out of range, array size is [1]
The query itself executes successfully (the INSERT is performed), but the debug template crashes when trying to display parameter information.
Root Cause Analysis
In Classic.cfc:403, the debug template iterates over paramValue1 but accesses paramType1 using the same index:
<cfloop from="1" to="#arraylen(paramValue1)#" index="i">
###i# Parameter(#paramType1[i]#) = #paramValue1[i]#
</cfloop>
The problem is that paramValue is being parsed as a comma-delimited list (via ListAsArray as seen in the stack trace), so a single value like "1111,222,333" becomes an array of 3 elements:
paramValue[1]= “1111”paramValue[2]= “222”paramValue[3]= “333”
Meanwhile, paramType correctly remains a single-element array:
paramType[1]= “CF_SQL_VARCHAR”
When the loop reaches i=2, it tries to access paramType1[2] which doesn’t exist.
Lucee 7 Comparison
This issue does not occur in Lucee 7. It appears that in Lucee 7, the debug data structure was changed to pass query parameters as proper arrays instead of comma-delimited strings. This preserves values containing commas as single elements.
Suggestion: Backport the Lucee 7 approach to the queries debug data structure in Lucee 6.x, or update the Classic debug template in Lucee 6 to handle string values that may contain commas.
Stack Trace
lucee.runtime.exp.ExpressionException: Array index [2] out of range, array size is [1]
at lucee.runtime.type.wrap.ListAsArray.getE(ListAsArray.java:119)
at lucee.runtime.type.wrap.ListAsArray.get(ListAsArray.java:346)
at debug.classic_cfc$cf.udfCall_000007(/lucee/admin/debug/Classic.cfc:403)
at debug.classic_cfc$cf.udfCall(/lucee/admin/debug/Classic.cfc:375)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:214)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:688)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:604)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2129)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:858)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:2105)
at admin.info.info_cfc$cf.udfCall(/lucee-server/admin/info/Info.cfc:31)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:214)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:688)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:604)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2129)
at lucee.runtime.listener.ModernAppListener.info(ModernAppListener.java:448)
at lucee.runtime.debug.DebuggerImpl.writeOut(DebuggerImpl.java:407)
at lucee.runtime.listener.ModernAppListener.onDebug(ModernAppListener.java:408)
at lucee.runtime.listener.MixedAppListener.onDebug(MixedAppListener.java:162)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2861)
...
Environment
- OS: Windows 10 (64-bit)
- Java: OpenJDK 11
- Server: CommandBox / Undertow
Workaround
- Disable debug output
- Switch to a different debug template (not Classic)
- Upgrade to Lucee 7