CodeSOD: Waiting for File IO…
by Remy Porter from The Daily WTF on (#4Q34)
Trisha had the misfortune to inherit some old Cold Fusion code. One particular block needed to see if a file existed before it continued, and apparently the original developer really wanted to be patient and make sure the file was there, so they wrote this:
<cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfelse> <cfset Good2Go = "Yes"> </cfif> <cfelse> <cfset Good2Go = "Yes"> </cfif> <cfelse> <cfset Good2Go = "Yes"> </cfif> <cfelse> <cfset Good2Go = "Yes"> </cfif><cfelse> <cfset Good2Go = "Yes"></cfif>
