Status/Resolution/Reason: To Fix//Investigate
Reporter/Name(from Bugbase): Phil M. / ()
Created: 10/01/2019
Components: Language, CF Component
Versions: 2018
Failure Type: Usability Issue
Found In Build/Fixed In Build: 2018,0,0,310739 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Win 2016
Vote Count: 0
Problem Description:
Using a function name of "initialize" in a component and referencing that method in another function in the same component causes run/compile time exception.
Steps to Reproduce:
test.cfc:
<cfcomponent output="false">
<cffunction name="initialize" access="public" output="false" returntype="void">
</cffunction>
<cffunction name="out" access="public" output="false" returntype="void">
<cfset initialize()>
</cffunction>
</cfcomponent>
Then in page perform the following.
<cfset createobject("component", "test").initialize()>
Actual Result:
The error occurred in D:/websites/xxx/test.cfc: line 6
4 :
5 : <cffunction name="out" access="public" output="false" returntype="void">
6 : <cfset initialize()>
7 : </cffunction>
8 : </cfcomponent>
coldfusion.compiler.validation.FunctionArgMismatchException: Parameter validation error for the INITIALIZE function.
at coldfusion.compiler.validation.FunctionValidator.checkArgCount(FunctionValidator.java:96)
at coldfusion.compiler.validation.CFMLCodeValidator.visit(CFMLCodeValidator.java:195)
at coldfusion.compiler.ASTruntimeCall.accept(ASTruntimeCall.java:432)
at coldfusion.compiler.ASTcfscriptStatement.accept(ASTcfscriptStatement.java:131)
at coldfusion.compiler.Node.walkChildren(Node.java:394)
at coldfusion.compiler.ASTcfscript.accept(ASTcfscript.java:17)
at coldfusion.compiler.Node.walkChildren(Node.java:394)
at coldfusion.compiler.ASTfunctionDefinition.accept(ASTfunctionDefinition.java:229)
at coldfusion.compiler.Node.walkChildren(Node.java:394)
at coldfusion.compiler.ASTstart.accept(ASTstart.java:122)
at coldfusion.compiler.NeoTranslator.validate(NeoTranslator.java:602)
at coldfusion.compiler.NeoTranslator.parseAndTransform(NeoTranslator.java:469)
at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:407)
at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:160)
at coldfusion.runtime.TemplateClassLoader$TemplateCache$1.fetch(TemplateClassLoader.java:478)
at coldfusion.util.LruCache.get(LruCache.java:180)
at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(TemplateClassLoader.java:404)
at coldfusion.util.AbstractCache.fetch(AbstractCache.java:58)
at coldfusion.util.SoftCache.get_statsOff(SoftCache.java:142)
at coldfusion.util.SoftCache.get(SoftCache.java:81)
at coldfusion.runtime.TemplateClassLoader.findClass(TemplateClassLoader.java:672)
at coldfusion.runtime.RuntimeServiceImpl.getFile(RuntimeServiceImpl.java:1108)
at coldfusion.runtime.RuntimeServiceImpl.resolveTemplatePath(RuntimeServiceImpl.java:1087)
at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper(TemplateProxyFactory.java:1694)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:70)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:56)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:8057)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:8076)
at cfindex2ecfm1297646937.runPage(D:\websites\xxx\index.cfm:174)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:262)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:729)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:565)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:504)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:162)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:96)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60)
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:226)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:311)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:46)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:121)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:426)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:844)
Expected Result:
No run/compile time exception.
Any Workarounds:
Put "this." in front of the method in the "out" function.
<cfcomponent output="false">
<cffunction name="initialize" access="public" output="false" returntype="void">
</cffunction>
<cffunction name="out" access="public" output="false" returntype="void">
<cfset this.initialize()>
</cffunction>
</cfcomponent>
Attachments:
Comments: