tracker issue : CF-3039556

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 79277:Here’s the original function that’s bombing (my indents don’t seem to be preserved when I post):<cffunction name="welcome"><cfset var local = header() /><cfset local = local & "<h1>Welcome!</h1>" /><c

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Brian J Meloche / Brian J Meloche (Brian J Meloche)

Created: 08/04/2009

Components: CFComponent, Components

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 241018 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Win All

Vote Count: 1

Problem:

Here’s the original function that’s bombing (my indents don’t seem to be preserved when I post):<cffunction name="welcome"><cfset var local = header() /><cfset local = local & "<h1>Welcome!</h1>" /><cfset local = local & footer() /><cfreturn displayView("home.welcome",local) /></cffunction>header() and footer() return strings. displayView() just renders the page in view/home/welcome.cfm.When I changed the welcome function to this, it worked:<cffunction name="welcome"><cfset var loc = header() /><cfset loc = loc & "<h1>Welcome!</h1>" /><cfset loc = loc & footer() /><cfreturn displayView("home.welcome",loc) /></cffunction>Anyway, this definitely seems like a bug with the local scope.  Here’s the error displayed:Complex object types cannot be converted to simple values.The expression has requested a variable or an intermediate expression result as a simple value. However, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.The most likely cause of the error is that you tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.The error occurred in C:\wamp\www\ClevelandCFUG\controller\home.cfc: line 16Called from C:\wamp\www\ClevelandCFUG\lightfront.cfc: line 101Called from C:\wamp\www\ClevelandCFUG\lightfront.cfc: line 86Called from C:\wamp\www\ClevelandCFUG\Application.cfc: line 7614 : <cffunction name="welcome">15 : <cfset var local = header() />16 : <cfset local = local & "<h1>Welcome!</h1>" />17 : <cfset local = local & footer() />18 : <cfreturn displayView("home.welcome",local) />Here is the stack trace:Stack Traceat cfhome2ecfc1252355423$funcWELCOME.runFunction(C:\wamp\www\ClevelandCFUG\controller\home.cfc:16) at cflightfront2ecfc348073780$funcPROCESSLIGHTFRONTEVENT.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:101) at cflightfront2ecfc348073780$funcLOADLIGHTFRONTREQUEST.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:86) at cfApplication2ecfc833889139$funcONREQUESTSTART.runFunction(C:\wamp\www\ClevelandCFUG\Application.cfc:76) coldfusion.runtime.CfJspPage$ComplexObjectException: Complex object types cannot be converted to simple values.at coldfusion.runtime.Cast._String(Cast.java:987)at cfhome2ecfc1252355423$funcWELCOME.runFunction(C:\wamp\www\ClevelandCFUG\controller\home.cfc:16)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:515)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:486)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:345)at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2293)at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:367)at cflightfront2ecfc348073780$funcPROCESSLIGHTFRONTEVENT.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:101)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:219)at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2574)at cflightfront2ecfc348073780$funcLOADLIGHTFRONTREQUEST.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:86)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:219)at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2574)at cfApplication2ecfc833889139$funcONREQUESTSTART.runFunction(C:\wamp\www\ClevelandCFUG\Application.cfc:76)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:403)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:219)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:481)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:327)at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:74)at coldfusion.runtime.AppEventInvoker.onRequestStart(AppEventInvoker.java:221)at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:302)at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:53)at coldfusion.CfmServlet.service(CfmServlet.java:200)at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)at jrun.servlet.FilterChain.service(FilterChain.java:101)at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) This simplified function also fails:<cffunction name="hello"><cfset var local = "<html><body>" /><cfset local = local & "<h1>Welcome!</h1>" /><cfset local = local & "</body></html>" /><cfreturn local /></cffunction>Aaron Neff posted a similar issue around the same time I found this issue (I'm filing this on behalf of both of us).If an included template sets the value of local.. i.e.:include.cfm----------------local={};local.this="that";local.foo="bar;then, when included into a function, the behavior differs between CF8 & CF9(I’ll admit, I found this on ’accident’, and perhaps isn’t a wide-spread issue)CF8: when dumping the local scope w/in the function, the included ’this’ & ’that’ keys will existCF9: when dumping the local scope w/in the function, the included ’this’ & ’that’ keys do not existMeaning, CF9 is ignoring "local=.." when directly in a function. It is not ignoring "local=.." when ’included into’ a function.Question: if "local=.." is ignored w/in functions, then shouldn’t it also be ignored when same logic is "included into" a function?just seems like a dangling loose end, that should be tightened up?
Method:

Included above.
Result:

Here’s the original function that’s bombing (my indents don’t seem to be preserved when I post):<cffunction name="welcome"><cfset var local = header() /><cfset local = local & "<h1>Welcome!</h1>" /><cfset local = local & footer() /><cfreturn displayView("home.welcome",local) /></cffunction>header() and footer() return strings. displayView() just renders the page in view/home/welcome.cfm.When I changed the welcome function to this, it worked:<cffunction name="welcome"><cfset var loc = header() /><cfset loc = loc & "<h1>Welcome!</h1>" /><cfset loc = loc & footer() /><cfreturn displayView("home.welcome",loc) /></cffunction>Anyway, this definitely seems like a bug with the local scope.  Here’s the error displayed:Complex object types cannot be converted to simple values.The expression has requested a variable or an intermediate expression result as a simple value. However, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.The most likely cause of the error is that you tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.The error occurred in C:\wamp\www\ClevelandCFUG\controller\home.cfc: line 16Called from C:\wamp\www\ClevelandCFUG\lightfront.cfc: line 101Called from C:\wamp\www\ClevelandCFUG\lightfront.cfc: line 86Called from C:\wamp\www\ClevelandCFUG\Application.cfc: line 7614 : <cffunction name="welcome">15 : <cfset var local = header() />16 : <cfset local = local & "<h1>Welcome!</h1>" />17 : <cfset local = local & footer() />18 : <cfreturn displayView("home.welcome",local) />Here is the stack trace:Stack Traceat cfhome2ecfc1252355423$funcWELCOME.runFunction(C:\wamp\www\ClevelandCFUG\controller\home.cfc:16) at cflightfront2ecfc348073780$funcPROCESSLIGHTFRONTEVENT.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:101) at cflightfront2ecfc348073780$funcLOADLIGHTFRONTREQUEST.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:86) at cfApplication2ecfc833889139$funcONREQUESTSTART.runFunction(C:\wamp\www\ClevelandCFUG\Application.cfc:76) coldfusion.runtime.CfJspPage$ComplexObjectException: Complex object types cannot be converted to simple values.at coldfusion.runtime.Cast._String(Cast.java:987)at cfhome2ecfc1252355423$funcWELCOME.runFunction(C:\wamp\www\ClevelandCFUG\controller\home.cfc:16)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:515)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:486)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:345)at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2293)at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:367)at cflightfront2ecfc348073780$funcPROCESSLIGHTFRONTEVENT.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:101)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:219)at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2574)at cflightfront2ecfc348073780$funcLOADLIGHTFRONTREQUEST.runFunction(C:\wamp\www\ClevelandCFUG\lightfront.cfc:86)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:219)at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2574)at cfApplication2ecfc833889139$funcONREQUESTSTART.runFunction(C:\wamp\www\ClevelandCFUG\Application.cfc:76)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:470)at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:403)at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:366)at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:319)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:219)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:481)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:327)at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:74)at coldfusion.runtime.AppEventInvoker.onRequestStart(AppEventInvoker.java:221)at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:302)at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:53)at coldfusion.CfmServlet.service(CfmServlet.java:200)at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)at jrun.servlet.FilterChain.service(FilterChain.java:101)at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) This simplified function also fails:<cffunction name="hello"><cfset var local = "<html><body>" /><cfset local = local & "<h1>Welcome!</h1>" /><cfset local = local & "</body></html>" /><cfreturn local /></cffunction>Aaron Neff posted a similar issue around the same time I found this issue (I'm filing this on behalf of both of us).If an included template sets the value of local.. i.e.:include.cfm----------------local={};local.this="that";local.foo="bar;then, when included into a function, the behavior differs between CF8 & CF9(I’ll admit, I found this on ’accident’, and perhaps isn’t a wide-spread issue)CF8: when dumping the local scope w/in the function, the included ’this’ & ’that’ keys will existCF9: when dumping the local scope w/in the function, the included ’this’ & ’that’ keys do not existMeaning, CF9 is ignoring "local=.." when directly in a function. It is not ignoring "local=.." when ’included into’ a function.Question: if "local=.." is ignored w/in functions, then shouldn’t it also be ignored when same logic is "included into" a function?just seems like a dangling loose end, that should be tightened up?

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3039556

External Customer Info:
External Company:  
External Customer Name: Brian J Meloche
External Customer Email: 04C7536843D1BE67992015D5
External Test Config: 08/04/2009

Attachments:

Comments:

+1, this issue of code breaking when "local" is set to anything other than a struct, needs to be fixed. (I think we should be allowed to specify, at function-level & component-level, the name of the struct we wish to have used for Explicit Local Scope. Also, if a struct having the same name as the Explicit Local Scope is "included" into a function, the keys in that struct should not simply 'vanish' (as is currently the case). CF9 should do as CF8 does, and 'add' those keys to the same-named struct that already exists in the function.
Vote by External U.
23145 | November 10, 2011 06:57:40 PM GMT