Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: A Unique Way to Primary Key

      July 22, 2025

      BrowserStack launches Figma plugin for detecting accessibility issues in design phase

      July 22, 2025

      Parasoft brings agentic AI to service virtualization in latest release

      July 22, 2025

      Node.js vs. Python for Backend: 7 Reasons C-Level Leaders Choose Node.js Talent

      July 21, 2025

      The best CRM software with email marketing in 2025: Expert tested and reviewed

      July 22, 2025

      This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

      July 22, 2025

      I’m a wearables editor and here are the 7 Pixel Watch 4 rumors I’m most curious about

      July 22, 2025

      8 ways I quickly leveled up my Linux skills – and you can too

      July 22, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025
      Recent

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025

      Zero Trust & Cybersecurity Mesh: Your Org’s Survival Guide

      July 22, 2025

      Execute Ping Commands and Get Back Structured Data in PHP

      July 22, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025
      Recent

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025

      “I don’t think I changed his mind” — NVIDIA CEO comments on H20 AI GPU sales resuming in China following a meeting with President Trump

      July 22, 2025

      Galaxy Z Fold 7 review: Six years later — Samsung finally cracks the foldable code

      July 22, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: The Last Last Name

    CodeSOD: The Last Last Name

    July 3, 2025

    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.

    [Advertisement]
    Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleFOSS Weekly #25.27: System Info, Retro Tools, Fedora 32-bit Update, Torvalds vs Bcachefs and More Linux Stuff
    Next Article AssetCool raises £10M Series A to scale robotic grid upgrade technology globally

    Related Posts

    News & Updates

    The best CRM software with email marketing in 2025: Expert tested and reviewed

    July 22, 2025
    News & Updates

    This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

    July 22, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    How to Create Telemetry Dashboards for Adobe Express Add-ons

    Web Development

    Reddit Users Secretly Manipulated by AI in Shocking Psychological Experiment

    Artificial Intelligence

    Micro-Animations Every Web Developer Can Master with Rive

    Web Development

    The most competent robot vacuum I tested last year just got a major upgrade

    News & Updates

    Highlights

    News & Updates

    GameSir just showed off its G7 Pro “Xbox Elite” controller, and it looksspectacular

    April 2, 2025

    GameSir G7 Pro has uploaded a new trailer for the GameSir G7 Pro, an upcoming…

    CVE-2025-0915 – IBM Db2 Memory Allocation DoS Vulnerability

    May 5, 2025

    search engine optimization new york

    July 10, 2025

    Hades 2 gets another major update bringing new art, godly powers, and romance as Supergiant gets ready for the game’s full release

    June 18, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.