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.
[Advertisement]
Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.
Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.
Source: Read MoreÂ