ColdFusion compiler is broken
Following on a tweet from Sean Corfield, I couldn’t believe it is possible to create a function called if, else, while and so on as well as declare variable called var. Here is the code that may hurt your head:
[sourcecode lang="cf"] <cffunction name="if"> <cfargument name="val1" /> <cfargument name="val2" /> <cfif val1 eq val2> <cfreturn true /> </cfif> <cfreturn false /> </cffunction> <cffunction name="hello"> <cfset var var = 2 /> <cfreturn var /> </cffunction> <cfif if( hello(), 2 )> LOL </cfif> [/sourcecode]
How cool is that ;)
September 22nd, 2009 at 1:34 pm
If that’s considered broken then its also broken in Railo.
September 22nd, 2009 at 1:40 pm
I don’t have Railo, I could test only with CF but good to know :)