tracker issue : CF-3547852

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

This setVariable expression not equivalent

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)

Created: 04/23/2013

Components: Language

Versions: 10.0

Failure Type: Crash

Found In Build/Fixed In Build: Final /

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Windows 7

Vote Count: 2

Problem Description:

expression fails but works with setVariable() even though they should be equivalent - http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7f48.html


Steps to Reproduce:

    memento.items = [];
    memento.items[5] = {src="123"};
    "memento.items[5].src" = "";

Actual Result:
   Valid variable names must start with a letter and can only contain letter, numbers, and underscores.

Expected Result:
  should work the same as: setVariable("memento.items[5].src", "")

Any Workarounds:
  use setVariable() instead.

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

Watson Bug ID:	3547852

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: henrylearn2rock
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Exception: Detail Valid variable names must start with a letter and can only contain letter, numbers, and underscores. ErrNumber 0 Message The string memento.items[5].src is not a valid ColdFusion variable name. StackTrace coldfusion.runtime.NeoPageContext$InvalidVariableNameException: The string memento.items[5].src is not a valid ColdFusion variable name. at coldfusion.runtime.NeoPageContext.SymTab_validateName(NeoPageContext.java:1515) at coldfusion.runtime.NeoPageContext.setAttribute(NeoPageContext.java:433) at coldfusion.runtime.NeoPageContext.setAttribute(NeoPageContext.java:427) at coldfusion.runtime.CfJspPage._set(CfJspPage.java:421) at cftest2ecfm471963496.runPage(D:\Webdata\templateadmin.website.com\remote\test.cfm:5) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:360) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:94) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) 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:62) at coldfusion.CfmServlet.service(CfmServlet.java:201) 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) Type Expression VarName memento.items[5].src
Comment by External U.
15548 | April 23, 2013 02:39:17 PM GMT
This is actually a vote against. I do not believe that the expectation should be that "x" = 1; in cfscript should be the same as a setVariable call. To me, the code above looks invalid.
Vote by External U.
15549 | April 23, 2013 07:42:10 PM GMT
The real problem is that setVariable() function has been expanded to accept strings containing l-values (expressions which produce a memory address) but the docs still state that it expects a variable name. The fact that the left-hand side of assignments accepts either an unquoted l-value or a quoted variable name but not a quoted l-value is not a bug. However this difference between assignment and setVariable() should be made clear in the documentation.
Vote by External U.
15550 | April 23, 2013 09:43:18 PM GMT