Differentiation by speling



  • A code snippet from a receipt page built around Authorize.net:

    $date = date("l, F d, Y ");
    
    
    
    	$aproval = $_POST["x_response_code"];
    		if ($aproval == "1"){
    			$approval = "Transaction was approved";
    			print "<center><b>Thank you for subscribing ...

    Two variables differentiated solely by whether the name is spelt correctly. The page also generates a mail to a guy who's been dead since January, so clearly no-one's noticed that it's stopped working.



  • I don't see the WTF... Obviously this is the secret to talking to the dead.

    We should all feel blessed, I think!

    Grandma! Spot!



  • @MasterPlanSoftware said:

    I don't see the WTF... Obviously this is the secret to talking to the dead.

    $approval is spelled two different ways:  $aproval and $approval.  Without seeing more code, I'd have to say this is just horrible variable naming. 



  • There's not a lot more code and it's totally self-contained in one small script, but it could be a lot worse if a whole code base was like this.



  • There's a line in one of the O'Reilly Perl books:

    Of course, choosing good or poor names makes no difference to Perl. You
    could name your program's three most-important variables $OOO000OOO,
    $OO00OO00, and $O0O0O0O0O and Perl wouldn't be bothered -- but in that
    case, please, don't ask us to maintain your code.



  • @belgariontheking said:

    @MasterPlanSoftware said:

    I don't see the WTF... Obviously this is the secret to talking to the dead.

    $approval is spelled two different ways:  $aproval and $approval.  Without seeing more code, I'd have to say this is just horrible variable naming. 

     Did you only read to the ellipses? There is no way anyone could take my post seriously.



  • I've seen something very similar. What happened was, there was some PHP code in a header file. That PHP code had a variable called $user_id. Files that included the header relied on $user_id being set to a value or null to determine if a user was logged in. However, because the header file set the variable, the user would always be logged in. How did the programmer fix it? Did he set the variable to null at the bottom of the header? Find a better way to check if a user is logged in? Nope, he just started using $usser_id in every single other source file for the entire project!



  • @Daniel Beardsmore said:

    The page also generates a mail to a guy who's been dead since January, so clearly no-one's noticed that it's stopped working.
    Or more correctly, nobody has noticed that he has stopped working.

    Sensitivity? What's that?
     



  • It's a very strange site run by a strange person ... I guess that no-one realised he (the dead guy) was ever receiving the mails, had no idea that they were ever sent or why, and weren't waiting for them. Which makes me wonder why they were ever being generated, and whether they were actually useful. The guy didn't know PHP, so probably had no idea how to stop them being sent. Cleaning up the site in my spare time is a long process ... now I just have hundreds of uselessly named image files to contend with and heaps of files that appear to do nothing (HTML pages, images, even a random video clip left lying around that's got nothing to do with us -- threw that out).

    (No disrespect to the dead -- he was a good friend, even if he made a terrible webmaster ;-)



  • The variable name is obviously about Application Roval.

    Although I have no idea what that is. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.