CodeSOD: Classic WTF: A Spoonful of Sugar
by Mark Bowytz from The Daily WTF on (#43HTM)
It's Black Friday in the US, which is a fancy way of saying that we're all busy murdering each other in WalMart over PS4s. In case we don't survive, remember us by this classic article about Cold Fusion. Original -- Remy
John S. was doing some work on the search feature of a client's website when he noticed that he would receive a 500 Server Error if he tested against the API with an empty string.
This struck John as being pretty strange since not only had the search feature had been in place for years, but also, he could go to the search page, click on the "Search" button without entering anything and receive an "Item Not Found" response.
Curious, John poked around the underlying web code behind the search page and found that a previous developer had been aware of the error and had implemented a quite precocious workaround.
<cfif Trim(url.searchText) EQ ""> <!--- empty string will cause an error ---> <cfset searchString="supercalifragilisticexpialidocious"></cfif> [Advertisement] ProGet supports your applications, Docker containers, and third-party packages, allowing you to enforce quality standards across all components. Download and see how!