G'day
Consider this code:
<cfset st = {key="value"}>
<cfset a = [st]>
<cftry>
<cfset b = arrayContains(a, st)>
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
<cffinally>
<cfdump var="#variables#">
</cffinally>
</cftry>
This errors with:
| Railo 3.3.4.003 Error (expression) |
| Message | Can't cast Complex Object Type Struct to String |
| Detail | Use Build-In-Function "serialize(Struct):String" to create a String from Struct |
The problem seems to be this (from
http://wiki.getrailo.org/wiki/3-1-Functions:ArrayContains):
Arguments
| Name | Type | Required | Position | Default | Description |
| haystack | Array | Yes | 1 |
|
|
| needle | String | Yes | 2 |
|
needle should not be a
string, it should be
anything (see
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS2EF4F7C2-F41D-42fe-940D-B7C0212FF3D9.html).
Also, to be completely equivalent to CF it should return a boolean, not a numeric (however I agree that CF's arrayContains() function returns a boolean is a bit daft).
I guess this could be legit if Railo's version of arrayContains() predates CF's?
--
Adam