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

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

      June 4, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 4, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 4, 2025

      Smashing Animations Part 4: Optimising SVGs

      June 4, 2025

      I test AI tools for a living. Here are 3 image generators I actually use and how

      June 4, 2025

      The world’s smallest 65W USB-C charger is my latest travel essential

      June 4, 2025

      This Spotlight alternative for Mac is my secret weapon for AI-powered search

      June 4, 2025

      Tech prophet Mary Meeker just dropped a massive report on AI trends – here’s your TL;DR

      June 4, 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

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025
      Recent

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025

      Simplify Negative Relation Queries with Laravel’s whereDoesntHaveRelation Methods

      June 4, 2025

      Cast Model Properties to a Uri Instance in 12.17

      June 4, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025
      Recent

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025

      Rilasciata /e/OS 3.0: Nuova Vita per Android Senza Google, Più Privacy e Controllo per l’Utente

      June 4, 2025

      Rilasciata Oracle Linux 9.6: Scopri le Novità e i Miglioramenti nella Sicurezza e nelle Prestazioni

      June 4, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Allowed Savings

    CodeSOD: Allowed Savings

    February 26, 2025

    The CEO of Delia‘s company retired. They were an old hand in the industry, the kind of person who worked their way up and had an engineering background, and while the staff loved them, the shareholders were less than pleased, because the company was profitable, but not obscenely so. So the next CEO was a McKinsey-approved MBA who had one mission: cut costs.

    Out went the senior devs, and much of the managers. Anyone who was product or customer focused followed quickly behind. What remained were a few managers handpicked by the new CEO and a slew of junior engineers- and Pierre.

    Pierre was a contractor who followed the new CEO around from company to company. Pierre was there to ensure that nobody wasted any time on engineering that didn’t directly impact features. Tests? Wastes of time. Module boundaries? Just slow you down. Move fast and break things, and don’t worry about fixing anything because that’s your successors’ problem.

    So let’s take a look at how Pierre wrote code. This block of PHP code was simply copy/pasted everywhere it needed to be used, across multiple applications.

    Hostinger
    foreach($alphaCheck as $checkField) {
      if($paramsArray[$checkField['field']]) {
        if($paramsArray[$checkField['field']]) {
          $invalidChars = false;
          $checkValue = trim(strtoupper($paramsArray[$checkField['field']]));
          $allowedChars = explode('|',"A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|-| |.|'");
          for($i=0; $i<strlen($checkValue); $i++) {
            if(!in_array($checkValue[$i],$allowedChars)) {
              $invalidChars = true;
            }              
          }            
          if($invalidChars) {
            $errorMsgs[] = $checkField['name'] . ' contains invalid characters';
          }            
        }          
      }        
    }
    

    This isn’t the worst approach to this problem I’ve seen in PHP, but the fact that this is just a copy/pasted blob, and worse- the $allowedChars may vary a bit in each place it’s copy/pasted is what makes it terrible.

    Don’t worry. The new CEO only stayed for 18 months, got a huge bonus thanks to all the cost-cutting, and then left, taking Pierre along to the next company.

    [Advertisement]
    BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!

    Source: Read More 

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleArmory – 3D game engine
    Next Article Dr.Parted Live – bootable Linux distribution

    Related Posts

    News & Updates

    I test AI tools for a living. Here are 3 image generators I actually use and how

    June 4, 2025
    News & Updates

    The world’s smallest 65W USB-C charger is my latest travel essential

    June 4, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    CVE-2025-4920 – Mozilla Firefox Promise Object Out-of-Bounds Read/Write Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Natural language boosts LLM performance in coding, planning, and robotics

    Artificial Intelligence

    Visual Studio adds support for code referencing of GitHub Copilot completions

    Tech & Work

    Here’s when Call of Duty: Black Ops 6 and Warzone Season 2 starts

    News & Updates

    Highlights

    CVE-2025-48847 – Dropbox Unvalidated Redirect

    May 28, 2025

    CVE ID : CVE-2025-48847

    Published : May 28, 2025, 4:15 a.m. | 44 minutes ago

    Description : Rejected reason: Not used

    Severity: 0.0 | NA

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    CVE-2025-3714 – “LCD KVM over IP Switch CL5708IM Stack-based Buffer Overflow Vulnerability”

    May 9, 2025

    How to Wait for the sibling-count() and sibling-index() Functions

    January 13, 2025

    How to Protect Your Business from Cyber Threats: Mastering the Shared Responsibility Model

    March 20, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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