tracker issue : CF-3341767

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

structCount() cannot ("count", I mean)

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 10/05/2012

Components: Language, Functions

Versions: 10.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: 8.0.1 /

Priority/Frequency: Normal / Most users will encounter

Locale/System: English / Win All

Vote Count: 1

Listed in the version 2016.0.0.297996 Issues Fixed doc
Verification notes: verified_fixed on August 26, 2019 using build 2016.0.01.298513
This actually occurs on all versions of CF from 8-10.

Full details @ repro case here:
http://adamcameroncoldfusion.blogspot.co.uk/2012/10/how-4-can-equal-3-or-possibly-5-in.html

Code here:
https://gist.github.com/3839563

Your bug tracker doesn't allow me to put the full repro case & description in (as it's more than 4000 chars), so you're just gonna have to refer to the links above.

Basically passing the arguments scope via an argumentCollection can screw the arguments scope up, and make it return unpredictable results for structCount(), structKeyList() etc.

-- 
Adam

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

Watson Bug ID:	3341767

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

[vansee ]can we check on the latest version?
Comment by Nimit S.
17723 | December 12, 2014 02:27:09 AM GMT
Changing the version info to 10.0 for as 8.0 and 9.0 are EOL
Comment by Vamseekrishna N.
17724 | September 13, 2015 11:15:38 PM GMT
[Piyush] It seems that the issue is observed only when the structcount is taken of a copy of the arguments scope, and a modification is made in any other struct in the scope local to the function, as demonstrated below: variables.stuCp = structCopy(arguments); writeoutput(structcount(variables.stuCp)); localData.copiedBefore.d = 4; writeoutput(structcount(variables.stuCp)); Ths issue is not observed in other cases like if the count is taken of some scope other than arguments: ----------------------------------------- variables.vstu = {a=1}; variables.stuCp = structCopy(variables.vstu); writeoutput(structcount(variables.stuCp)); variables.vstu.d = 1; writeoutput(structcount(variables.stuCp)); ----------------------------------------- or if some struct other than one in a function local scope is modified, as follows: ----------------------------------------- variables.vstu = {a=1}; variables.stuCp = structCopy(arguments); writeoutput(structcount(variables.stuCp)); variables.vstu.d = 4; writeoutput(structcount(variables.stuCp)); -----------------------------------------
Comment by Vamseekrishna N.
17725 | September 13, 2015 11:29:45 PM GMT
The issue was not about structCount, But it was about structCopy of arguments. If you structcopy arguments then doing any changes on copied struct also used to effect arguments struct. Like try to change a key in new copied struct which was existing in arguments struct, value used to change everywhere in arguments and all copied structs. In easy words you can think of structcopy of arguments was not cloning but holding it by reference(in some ways), so counting of keys and modification of values was messed up. Fixed it now.
Comment by Milan C.
17726 | September 26, 2015 05:02:49 PM GMT
+1 ......................
Vote by External U.
17727 | September 27, 2015 01:33:23 PM GMT
Hi Adobe, I've verified this is fixed in CF2016 Update 1 (build 2016.0.01.298513). Thanks!, -Aaron
Comment by Aaron N.
31220 | August 26, 2019 08:46:01 AM GMT