tracker issue : CF-4184965

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

[regression] "Variable ___IMPLICITARRYSTRUCTVAR2 is undefined."

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): / ext-user (Anit Kumar Panda)

Created: 08/29/2016

Components: Language

Versions: 2016

Failure Type: Non Functioning

Found In Build/Fixed In Build: 299076 / 303894

Priority/Frequency: Major / Few users will encounter

Locale/System: English / Linux All,Mac 10 All,Solaris All,Win XP All

Vote Count: 5

Problem: "Variable ___IMPLICITARRYSTRUCTVAR2 is undefined."

Method: Try the below code:-

<cfscript>
writeOutput("#server.coldfusion.productVersion#<br>");

st = {};
k = "key";
try {
	st[k] = st[k] ?: {};
} catch (any e){
	writeOutput("#e.message#<br>");
} finally {
	writeDump(st);
}

try {
	st[k] = st.keyExists(k) ? st[k] : {};
} catch (any e){
	writeOutput("#e.message#<br>");
} finally {
	writeDump(st);
}
</cfscript>

Result: "Variable ___IMPLICITARRYSTRUCTVAR2 is undefined."

Expected: It should work.

Workaround: It creates an array in 2016,0,01,298513, not a struct.

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

Watson Bug ID:	4184965

External Customer Info:
External Company:  
External Customer Name:  
External Customer Email:

Attachments:

Comments:

no, it doesn't *work* in 2016,0,01,298513. In that version it creates an array, not a struct.
Comment by External U.
1929 | August 29, 2016 09:18:52 AM GMT
I have made the corrections. Thanks Adam.
Comment by Anit K.
1930 | August 29, 2016 09:29:49 AM GMT
A more concise repro case is: foo={}; foo.bar = foo.bar ?: {}; This is a pretty nasty bug. Is there an ETA on when it will be fixed?
Comment by External U.
1931 | October 01, 2016 09:34:02 PM GMT
Ran Elvis Regression , breaks following cases: <cf_qatest id="t5"> <cftry> <cfscript> function myfunc2(myinput) { //writedump(myinput); //writeOutput("calling func2"); return myinput; } function myfunct1(id) { //writeOutput("calling func1"); return javacast("null",""); } function getById(id){ return myfunct1(id) ?: myfunc2({name="suchi",id="1234"}); } </cfscript> <cfset myobj=getById("suchi")> <cfoutput>#myobj.name#</cfoutput> <cfcatch> <cfdump var="#cfcatch#"> </cfcatch> </cftry> <cf_expectedresults> suchi </cf_expectedresults> </cf_qatest> <hr> <h3>Bug CF-3951221 :Elvis operator issue when the third operand is a function or variable</h3> <cf_qatest id="t6"> <cftry> <cfscript> function myfunc(myinput) { if (myinput=="suchi") return javacast("null","") ; else return myinput; } function getById1( id ){ y = 10; //writeOutput(id); return myfunc(id) ?: y?:myfunc(90990); } </cfscript> <cfset myobj=getById1("suchi")> <!---<cfdump var="#myobj#">---> <cfoutput>#myobj#</cfoutput> <cfcatch> <cfdump var=#cfcatch#> <cfoutput>#cfcatch.message#</cfoutput> </cfcatch> </cftry> <cf_expectedresults> 10 </cf_expectedresults> </cf_qatest> <hr>
Comment by Suchika S.
1932 | October 03, 2016 07:22:45 AM GMT
An additional case of the same error is as follows, either of those lines break <cfscript> variables.metaextends = mystructdoesnotexist ?: {}; variables.myarray = myarraydoesnotexist ?: []; </cfscript> <cfdump var="#variables#">
Comment by External U.
1933 | October 24, 2016 03:21:17 PM GMT
It makes elivis operator unusable but also [] is busted too see my comment not just {}
Vote by External U.
1935 | October 25, 2016 03:21:51 PM GMT
Any news on this or any kind of indicative ETA ? We rely on fixes from the latest Updater 3 but then this one being a regression means we would need to rewrite big swathes of code to deal with this issue
Comment by External U.
1934 | November 14, 2016 11:36:50 AM GMT