Title:
Unable to assign result of a QueryExecute to a bracket style variable reference
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/MustFix
Reporter/Name(from Bugbase): Isaiah F. / ()
Created: 02/12/2019
Components: Core Runtime, Parser/Compiler
Versions: 2016,11.0,2018
Failure Type: Others
Found In Build/Fixed In Build: 11,0,16,313933 / 313973
Priority/Frequency: Normal /
Locale/System: / Linux Ubuntu 14.04
Vote Count: 7
Problem Description: Assigning the result of a QueryExecute directly to a bracket style variable reference results in an exception in the compiler.
Steps to Reproduce:
{code:java}
<cfset rs = QueryNew('col', 'integer', [[1]])>
<cfset vrs = {}>
<cfset vrs['foo'] = QueryExecute("select * from rs", {}, {dbtype = 'query'})>
<cfdump var="#vrs#">
{code}
Actual Result:
The CFML compiler encountered an unexpected java.lang.ClassCastException exception.
The reason for this was: coldfusion.compiler.ASTarrayReference cannot be cast to coldfusion.compiler.ASTsimpleVariableReference Occurred at:
java.lang.ClassCastException: coldfusion.compiler.ASTarrayReference cannot be cast to coldfusion.compiler.ASTsimpleVariableReference
at coldfusion.compiler.Treewalker.postorder(Treewalker.java:90)
at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)
at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)
at coldfusion.compiler.NeoTranslator.parseAndTransform(NeoTranslator.java:459)
at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:391)
at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:160)
at coldfusion.runtime.TemplateClassLoader$TemplateCache$1.fetch(TemplateClassLoader.java:461)
at coldfusion.util.LruCache.get(LruCache.java:180)
at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(TemplateClassLoader.java:387)
at coldfusion.util.AbstractCache.fetch(AbstractCache.java:58)
at coldfusion.util.SoftCache.get_statsOff(SoftCache.java:133)
at coldfusion.util.SoftCache.get(SoftCache.java:81)
at coldfusion.runtime.TemplateClassLoader.findClass(TemplateClassLoader.java:642)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:138)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:78)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:121)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:458)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:196)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Expected Result:
A dump showing the struct with a key `foo` that has a query with one row, with one column `col` with a value of `1`
Any Workarounds:
Assign the value of the `QueryExecute` to a normal variable, then assign that variable to the bracket style variable reference. E.g.
{code:java}
<cfset rs = QueryNew('col', 'integer', [[1]])>
<cfset vrs = {}>
<cfset tmp = QueryExecute("select * from rs", {}, {dbtype = 'query'})>
<cfset vrs['foo'] = tmp>
<cfdump var="#vrs#">
{code}
Attachments:
Comments: