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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 31, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 31, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 31, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 31, 2025

      How to install SteamOS on ROG Ally and Legion Go Windows gaming handhelds

      May 31, 2025

      Xbox Game Pass just had its strongest content quarter ever, but can we expect this level of quality forever?

      May 31, 2025

      Gaming on a dual-screen laptop? I tried it with Lenovo’s new Yoga Book 9i for 2025 — Here’s what happened

      May 31, 2025

      We got Markdown in Notepad before GTA VI

      May 31, 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

      Oracle Fusion new Product Management Landing Page and AI (25B)

      May 31, 2025
      Recent

      Oracle Fusion new Product Management Landing Page and AI (25B)

      May 31, 2025

      Filament Is Now Running Natively on Mobile

      May 31, 2025

      How Remix is shaking things up

      May 30, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      How to install SteamOS on ROG Ally and Legion Go Windows gaming handhelds

      May 31, 2025
      Recent

      How to install SteamOS on ROG Ally and Legion Go Windows gaming handhelds

      May 31, 2025

      Xbox Game Pass just had its strongest content quarter ever, but can we expect this level of quality forever?

      May 31, 2025

      Gaming on a dual-screen laptop? I tried it with Lenovo’s new Yoga Book 9i for 2025 — Here’s what happened

      May 31, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Stripped of Magic

    CodeSOD: Stripped of Magic

    January 23, 2025

    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[^\Sn]*(?=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.

    Hostinger

    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 Confidence
    Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleFOSS Weekly #25.04: Must-know Jargon, Kernel 6.13 Released, Mint 22.1, WINE 10 and More Linux Stuff
    Next Article Btrbk – backup tool for btrfs subvolumes

    Related Posts

    News & Updates

    How to install SteamOS on ROG Ally and Legion Go Windows gaming handhelds

    May 31, 2025
    News & Updates

    Xbox Game Pass just had its strongest content quarter ever, but can we expect this level of quality forever?

    May 31, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Microsoft’s ‘Avowed’ advanced access inexplicably skips Xbox Cloud Gaming in favor of NVIDIA GeForce Now, putting Xbox customers last

    News & Updates

    Adobe Acrobat’s AI Assistant can now decipher complex contracts for you

    News & Updates

    15 Ways to Earn from Home

    Artificial Intelligence

    Jina AI Introduces Jina-CLIP v2: A 0.9B Multilingual Multimodal Embedding Model that Connects Image with Text in 89 Languages

    Development

    Highlights

    Artificial Intelligence

    AI’s impact on the job market: Conflicting signals in the early days

    April 29, 2025

    As more real-world data on AI’s economic impact on the job market is revealed, the…

    Screen Reader Accessibility Testing Tools

    February 26, 2025

    Interesting design ideas

    March 25, 2025

    Dozens of users can’t find the Robux gift cards in Microsoft Rewards anymore

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

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