I've looked into this some more, and it seems to me that MockBox is
making some assumptions about the toString() method of
coldfusion.runtime.ArgumentCollection which are not necessarily true.
This code demonstrates:
<!--- TesthashArgs.cfc --->
<cfcomponent>
<cffunction name="f" returntype="struct">
<cfset var stReturn = structNew()>
<!--- what mockbox does --->
<cfset stReturn.toString = arguments.toString()><!--- this doesn't
always return same results from call to call --->
<cfset stReturn.hash = hash(stReturn.toString)><!--- therefore the
hash is not necessarily the same. However mockbox RELIES on this
always being the same --->
<!--- seeing if native CF handles it better: no --->
<cfwddx action="cfml2wddx" input="#arguments#"
output="stReturn.wddx"><!--- this also doesn't always return same
results from call to call --->
<cfset stReturn.wddx = htmlEditFormat(stReturn.wddx)><!--- just
escaping it so we can see actual value in DUMP --->
<cfreturn stReturn>
</cffunction>
</cfcomponent>
<!--- testhashArgs.cfm --->
<cfset o = createObject("component", "TestHashArgs")>
<cfset dteArgDate = now()>
<cfset st1 = o.f(
strArg1 = "foo",
dateArg = dteArgDate
)>
<cfset st2 = o.f(
strArg1 = "foo",
dateArg = dteArgDate
)>
<cfif st1.hash eq st2.hash>
OK
<cfelse>
<cfdump var="#st1#" label="st1">
<cfdump var="#st2#" label="st2">
</cfif>
About 50% of the time, toString() resolves the order of the keys of
the argumentCollection in a different order, so the resultant string
is different, so the hash is different. The %age of success varies
depending on the names of the args, which is quite strange.
However the result is entirely predictable - indeed I would have
expected it to fail more often - because the keys of a struct are
intrinsically not ordered, so no assumptions ought to be made about
their ordering. Which is where MockBox goes wrong: it relies on there
being intrinsic ordering in the serialised arguments which simply
isn't there.
I'm afraid this is a bug in MockBox, not a "CF issue", because MockBox
is making this invalid assumption 