We're just looking at porting a legacy script to ColdFusion 10 and I believe I have come across a bug/change in functionality relating to the use of multiple form fields using the same name. In ColdFusion 9 these would have been appended to the relevant variable with commas, but in ColdFusion 10, if the case of the variables is different one field will overwrite the other.
The following test code:
<form action="index2.cfm" method="post">
<input type="hidden" name="test" value="1" />
<input type="hidden" name="TEST" value="0" />
<input type="submit" />
</form>
<cfdump var="#form#">
Produces on ColdFusion 9
TEST = 1,0
On ColdFusion 10:
TEST = 0
Has anyone else experienced this behaviour and knows whether it is a bug or intended functionality? I know the application shouldn't be using the same variable name in different cases, so will look at changing this, but just wondered if anyone had any more information on the issue.
Edit
I have submitted this bug to Adobe at https://bugbase.adobe.com/index.cfm?event=bug&id=3298179
ColdFusion variables are not case sensitive. However, consistent capitalization makes the code easier to read.
CFML is dynamically typed, so types can change as required. You can see the current (JVM) type of a variable by doing <cfdump var=#getMetadata(var)# /> or simply by accessing getMetadata(var). getName() .
Tests for a parameter's existence, tests its data type, and, if. a default value is not assigned, optionally provides one.
@Russ
This feature is indeed just that a feature. I believe you've missed the point in the above post that specifying the same field name with different case no longer passes a list result.
One of the main things I and many have used this functionality for in the past is checkboxes. A group can have the same name so that your validation is easy yet different values so CF can process which ones have been ticked before form submission(obviously unticked items aren't passed into the list).
This bug appears to have been confirmed by Adobe in as Bug #3298179. It is reported as fixed in build 283412 and currently in the testing phase. I will update this answer with the relevent hotfix information once this has been released publicly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With