When writing Perl, it's not unusual to want to die. The die function ends your Perl program with an error string, and you'll often see code like: die "My error" unless $i > 5 or die "Other error" if check(), because Perl just loves the backwards conditionals. What's even more fun with die is how it behaves with eval blocks, so it doesn't always kill your program, sometimes it is how you pass error strings back out of sections of your program.

And poor Bobby has inherited some Perl that just really loves to die.

public function store()
{
    echo 'Hello'; die;
    if (Auth::attempt(Input::only('email', 'password')))
    {
        echo 'done'; die;
        // return "welcome ".Auth::user()->username
    }
    echo "Oops! Fails"; die;
    return Redirect::back()->with_input();
}

Bobby didn't send the source control history here, but I have a sense of what it likely was like, once. If they authenticate successfully, print a welcome message. If they don't, redirect back to the logon page and let them try again. I suspect they wanted to disable the route. So first they disabled the success path, only to discover that the failure path kept redirecting, so they disabled that too. Finally, they added the Hello at the top to disable the whole thing.

Why? Why did they do any of this? No idea. It feels like debugging code, but you'd expect more echos and fewer dies if that were the case. And you wouldn't expect it to leak into production and sit there for years, which is what happened here.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!