Residents left raging at hair salon in neighbour's back garden in Eastwood
STEPHEN GLOVER: Why I don't share the joy of my friend who wept tears of delight as he watched Trump's woke-baiting speech
Boosting the UK economy must trump Labour's dash for net zero, says Rachel Reeves as new push for growth sets collision course with Ed Miliband
Inside the life of Princess Caroline of Monaco: From looking 'just like' her glamorous mother Grace Kelly to her controversial VERY young wedding
Donald and Melania Trump's surprise-packed wedding guest list resurfaces as pair celebrate 20 years of marriage
Why Britain should follow Trump's lead and pull out of the WHO which failed so wretchedly over Covid
My menopause triggered a potentially deadly condition that left me needing emergency hospital treatment - I thought I was going to die, but doctors didn't take me seriously
Asus lets processor security fix slip out early, AMD confirms patch in progress
AMD has confirmed at least some of its microprocessors suffer a microcode-related security vulnerability, the existence of which accidentally emerged this month after a fix for the flaw appeared in a beta BIOS update from PC maker Asus.…
Police name man accused of attempted murder after shooting in residential Waltham Abbey street
Inside Lewis Hamilton's dream Ferrari debut: JONATHAN McEVOY takes you behind the scenes in Maranello to reveal how Lewis has already won over the 'Tifosi' and an exclusive dinner at Michael Schumacher's favourite restaurant
Teenage boy, 16, charged with attempted murder and kidnap after shopping centre incident
2025 Grammy winners 'leaked' ahead of awards show - and one major artist is set for a shock snub
Scientists Detect Chirping Cosmic Waves In an Unexpected Part of Space
Read more of this story at Slashdot.
Trump gives radical new powers to federal agents to form mass deportation strike force as illegals are already being rounded up
Obama strategist reveals why Biden's last-minute decision to pardon family members has backfired
Blake Lively and Justin Baldoni's costar Jenny Slate bombarded by cruel trolls amid their bitter legal battle
JD Vance virtually speechless as Trump takes him into the Oval Office for the first time
Billionaires at heart of Trump administration in public spat as Elon Musk doubts $500B Stargate investment
Caitlyn Jenner is brutally mocked online for supporting Trump as fans point out detail in inauguration speech
CodeSOD: Stripped of Magic
A Representative Line is a short snippet that makes you think, "wow, I'd hate to see the rest of the code." A CodeSOD is a longer snippet, which also frequently makes you think, "wow, I'd hate to see the rest of the code," but also is bad in ways that require you to look at the relationship between the lines in the code.
I bring that up, because today's code sample is a long section, but really, it's just a collection of representative lines. Each line in this just makes me die a little on the inside.
Belda found this:
## helper functions function stripmagic($x) { return get_magic_quotes_gpc() ? stripslashes($x) : $x; } function pre_r(&$x) { return '<pre>'.PHSC(print_r($x, true)).'</pre>'; } function PSS($x) { return str_replace('\\"','"',$x); } function PVS($x) { return preg_replace("/\n[^\\S\n]*(?=\n)/", "\n<:vspace>", $x); } function PVSE($x) { return PVS(PHSC($x, ENT_NOQUOTES)); } function PZZ($x,$y='') { return ''; } function PRR($x=NULL) { if ($x || is_null($x)) $GLOBALS['RedoMarkupLine']++; return $x; } function PUE($x) { return preg_replace('/[\\x80-\\xff \'"<>]/e', "'%'.dechex(ord('$0'))", $x); } function SDV(&$v,$x) { if (!isset($v)) $v=$x; } function SDVA(&$var,$val) { foreach($val as $k=>$v) if (!isset($var[$k])) $var[$k]=$v; }This collection of one-line "helper" functions has it all. Cryptic function names. PRR mutates global variables. PZZ just… returns an empty string. I don't know what PHSC does, and I don't want to, but it's called inside of pre_r and PVSE. Which I also don't know what they do. Speaking of PVSE, I note the regex is using backreferences, which is some advanced regex but I still have no idea what it's doing. I could figure it out, but I don't want to. PUE looks like it might be handling some misencoded characters, maybe. SDV is maybe kinda a coalesce function.
Each line is its own representative line. None of this is code I'd want to maintain.
On the flip side, the abbreviated function names, when read in reverse order, are exactly the sounds I made when I read this code: "SDVASDVPUEPRRPZZPVSEPVSPSS".
It's okay, the doctors say I'll make a full recovery.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!