Status/Resolution/Reason: Closed/Withdrawn/Duplicate
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 08/30/2012
Components: Language
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final / 292325
Priority/Frequency: Major / Some users will encounter
Locale/System: English / Win All
Vote Count: 3
Duplicate ID: CF-3341256
Problem Description:
Looping over arrays with <cfloop> is a bit munged. The construct is <cfloop index="element" array="array">. Note that I observe the problem here: the INDEX attribute doesn't actually hold the index, it holds the element itself. And the real index value is not actually exposed at all. I would say the bulk of the time one would want the index as much as one would want the element; and at least if one has the index then one can derive the element (not the other way around though).
Can I suggest you deprecate that, and implement this:
<cfloop index="index" element="element" array="array">
This would expose both the index and the element, and would use the correct name for each. Plus would be backwards compat with the existing incorrect one (in that both could still work fine).
Filing as a bug not an E/R as the index/element thing in the existing behaviour is a bug.
Cheers.
--
Adam
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3321646
External Customer Info:
External Company:
External Customer Name: Adam Cameron.
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: