Diddy's jubilant mom and kids break silence on shock verdict as Cassie holes up at NYC home
Jennifer Lopez looks somber as she hits the dance studio while ex Diddy fights prison after split verdict
Diddy's family reveal rapper's next move after stunning 'second chance' verdict
The Gatsby of Sleaze: Diddy loved the fawning comparisons to F. Scott Fitzgerald's party-throwing tycoon, but for every A-lister there was a topless model writhing around with a sex-obsessed host and seedy cronies
Kathy Griffin looks unrecognizable as she steps out in LA after anti-Trump TikTok drama
Parenting expert reveals important reason why you SHOULD teach your child to answer back
A New 'Interstellar Visitor' Has Entered the Solar System
Read more of this story at Slashdot.
The Essex areas where shoplifting causes high street havoc 'on a daily basis'
Scientists are BAFFLED after discovering the first ever 'planet with a death wish' - and say it's a completely new phenomenon
Rachel needed a hug. Instead Starmer did the opposite - sucking her dry to shore up his own position like the political vampire he is: SARAH VINE
The family friend who's ALWAYS been waiting in the wings for his shot with Mel B - and how he wooed Scary Spice
This country has the lowest retirement age in Europe - and it's 14 years earlier than the UK
Tragedy as body of teenage boy is pulled from river after 'entering with pals' as heatwave continues
Rita Ora FINALLY discusses THAT 'Becky with the good hair' cheating rumour
Cara Delevingne kisses girlfriend Minke and shows off their matching Alanis Morissette tattoos while at the side of the stage at rock star's Glasto gig
Cold-blooded steps Bryan Kohberger took to cover up the Idaho murders are revealed for the first time
What Prince Harry and Prince William could learn from Liam and Noel Gallagher as the Oasis frontmen gear up for their reunion tour
ChatGPT creates phisher’s paradise by recommending the wrong URLs for major companies
AI-powered chatbots often deliver incorrect information when asked to name the address for major companies’ websites, and threat intelligence business Netcraft thinks that creates an opportunity for criminals.…
CodeSOD: The Last Last Name
Sometimes, you see some code which is perfectly harmless, but illustrates an incredibly dangerous person behind them. The code isn't good, but it isn't bad in any meaningful way, but it was written by a cocaine addled Pomeranian behind the controls of a bulldozer: it's full of energy, doesn't know exactly what's going on, and at some point, it's going to hit something important.
Such is the code which Román sends us.
public static function registerUser($name, $lastName, $username, ...) { // 100% unmodified first lines, some comments removed $tsCreation = new DateTime(); $user = new User(); $name = $name; $lastname = $lastName; $username = $username; $user->setUsername($username); $user->setLastname($lastname); $user->setName($name); // And so on. }This creates a user object and populates its fields. It doesn't use a meaningful constructor, which is its own problem, but that's not why we're here. We're here because for some reason the developer behind this function assigns some of the parameters to themselves. Why? I don't know, but it's clearly the result of some underlying misunderstanding of how things work.
But the real landmine is the $lastname variable- which is an entirely new variable which has slightly different capitalization from $lastName.
And you've all heard this song many times, so sing along with the chorus: "this particular pattern shows up all through the codebase," complete with inconsistent capitalization.
.comment { border: none; }