Skip to main content

Representative Line: The Whole Thing

3 months 2 weeks ago

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.
Remy Porter

Sonos CEO steps down after smart speaker app upgrade hit bum note

3 months 2 weeks ago
Board appoints interim leader to stay in tune with its turnaround song, both execs hear sweet sound of cash landing in the bank

Smart speaker outfit Sonos has parted ways with CEO Patrick Spence, who oversaw the release of an app that was billed as an upgrade but instead made the company’s products worse and riled customers.…

Simon Sharwood