Title:
CFCLIENT: datastructures : struct : duplicate : Get duplicate of struct. Changing the value of referenced struct of its nested struct does not change value of its other nested struct when both nested structs refer to the same struct
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): / ext-user (Anuj Nawani)
Created: 04/07/2014
Components: Mobile Support, Data Structure
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: 289635 /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 0
Code snippet:
<div id="actual_1" class="actual">
<cfclient>
<cfscript>
stAddressInner = structNew();
stAddressInner.country = "India";
stEmployee = structNew();
stEmployee.residenceAddress = stAddressInner; // pointer to stAddressInner
stEmployee.officeAddress = stAddressInner; // also a pointer to stAddressInner. So point to same data.
dupStruct = duplicate(stEmployee);
</cfscript>
<cfscript>
dupStruct.residenceAddress.country = "UK";
</cfscript>
<cfoutput>
#dupStruct.officeAddress.country#
</cfoutput>
</cfclient>
</div>
Expected: UK
Actual: India
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3738100
External Customer Info:
External Company:
External Customer Name:
External Customer Email:
Attachments:
Comments: