$commentText = preg_replace(”/\n/”, “”, stripExcessLineBreaks(str_replace(” ”, “”, str_replace(”&”,”&”,str_replace(”u0026#39;”,”'”, str_replace(”‘”, “'”, str_replace(”u0026amp;”, “&”, str_replace(”u0026quot;”, “"”, nl2br(htmlspecialchars(htmlspecialchars_decode(stripHTML(stripReplyText($message['body'], true))),ENT_NOQUOTES))))))))));
Posted in FAIL | No Comments »
Not that it surprises me that much, but there are some truly bizarre chunks of code in WordPressMU. Check out this hot piece of love:
$wpdb->query( "UPDATE $wpdb->usermeta SET meta_value = 'a:1:{s:" . strlen( $role ) . ":\"" . $role . "\";b:1;}' WHERE user_id = '$userid' AND meta_key = '" . $wpdb->base_prefix . $id . "_capabilities'" );
Yeah that’s right, a manually constructed string, representing a serialized array. WTF?
Posted in FAIL | No Comments »
I just wrote "if (!$retval) {". In C code. :facepalm:
From Andrei Zmievski via Twitter.
Andrei is a leader in the PHP community, spearheading PHP development and bringing us closer to PHP6.
Just goes to show that developers are human too. (Sorta.)
Posted in FAIL | 1 Comment »
Screwed by the Goog!

Posted in FAIL | No Comments »
Found on http://www.americanbaby.com/404.html (You need to disable javascript before loading to see it.)
<body onLoad="redirect()">
<!-- this is a comment
the whole thing
please disregard this
unless you're Bill GAtes and
in which case this is all your fault
-->
</html>
Ugh. Gotta love Microsoft’s inability to adhere to standards.
Also, see this: Open Letter to IE6 for 2009
Posted in FAIL | No Comments »
This method is supposed to determine if a post is a draft or not. I’ll let it speak for itself.
public function __get_draft() {
if ($this->visible == 0 && $this->archived == 0 && $this->deleted = 0) {
return true;
} else {
return true;
}
}
Posted in FAIL | No Comments »
Found this bit in a model class of my own.
static public function active_product($product_type, $role_id) {
$q = 'SELECT COUNT(*)
FROM product
WHERE
visible = 1 AND
(deleted = 0 OR archived = 0) AND
postedby_role_id = ? AND
product_type = ?';
$sth = $dbh->prepare($q);
$sth->execute($role_id, $product_type);
$product_count = 0;
while(list($count) = $sth->fetchrow_array()) {
$product_count += $count;
}
return $product_count;
}
WTF was I smoking?
Posted in FAIL | 2 Comments »
if($state_check) {
$selected_state=$state_code;
} else {
$selected_state=$state_code;
}
… too bad $state_check was not defined…
Posted in FAIL | 2 Comments »
Here’s a JavaScript function, buried deep within a 5000+ line JavaScript file with absolutely no documentation, let alone variables that might indicate what the function’s use is.
function checkCheck(ct) {
var v1;
var v2 = false;
var x;
for(x = 1; x <= ct; x++) {
v1 = $('check_' + x);
if(v1) {
if(v1.checked == 1) {
return true;
break;
}
else {
continue;
}
}
}
return v2;
}
Aside from the weirdness of the return/break/continue statements, v2 is never even used other than just to return false!
Posted in FAIL | 1 Comment »
Have you ever come across a piece of code that is so horrible that it makes you want to scream? Have you ever wanted to smack a co-worker upside their head for employing horrible coding practices?
If so, then this is the site for you! We will feature the “Best of the Worst”, taking submissions from all over the world with your most horrible, mind boggling, stupid programming and development failures you’ve ever had the displeasure of gracing your monitor.
Welcome to devFAIL!
Posted in Messages | No Comments »