Juliano had this very non-WTF bit of PHP code:

if (!$path) {
	//do stuff
} else {
	//do other stuff
}

After another team member made a commit, however, the code turned into this:

if (1 == 2) {
	//do stuff
} else {
	//do other stuff
}

Now, generally, when I see 1 == 2 type expressions, I just assume that this is a templated, generated bit of code. I usually (but not always) avoid using those as WTFs. But here, we have an actual case where the developer manually changed the code because they wanted to disable a branch. There is no comment, the commit message isn't helpful for understanding the change. You just have this awkwardly mysterious bit that now lives in the code, with no clear history and no clear purpose.

In an ideal world, you'd just delete the dead code and let version control history worry about previous versions. In a less than ideal world, you'd comment why you disabled the branch, in-line in the code (and also in the commit, and arguably a few other places). Instead of putting in a nonsense condition, perhaps you do a if (!path && false) { //disabling this branch because X instead.

But no, we did none of that. Now we just have a mystery, lingering in the code, waiting for future developers to stumble across it and ask, "WTF?"

[Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!