Representative Line: The Whole Thing
by Remy Porter from The Daily WTF on (#6TJ38)
David was integrating a new extension into their ecommerce solution, and found this un-representative line:
$this->model_sale_manageorder->exportOrder(substr($selectid,0,strlen($selectid)-1));
Note the use of substr- we take the substr of $selectid from 0 to strlen($selectid)- aka, we take the entire string.
Perhaps this is leftover code, where once upon a time there was a prefix or suffix on the string which needed to be ignored. But the result is code that is rather dumb.
I call this an "un-representative line" because, according to David, the rest of the code in the extension was actually rather good. Even otherwise good code is not immune to having a little fart hiding under the covers, I suppose.
