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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 2, 2025

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

      June 2, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 2, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 2, 2025

      How Red Hat just quietly, radically transformed enterprise server Linux

      June 2, 2025

      OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

      June 2, 2025

      The best Linux VPNs of 2025: Expert tested and reviewed

      June 2, 2025

      One of my favorite gaming PCs is 60% off right now

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

      `document.currentScript` is more useful than I thought.

      June 2, 2025
      Recent

      `document.currentScript` is more useful than I thought.

      June 2, 2025

      Adobe Sensei and GenAI in Practice for Enterprise CMS

      June 2, 2025

      Over The Air Updates for React Native Apps

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

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025
      Recent

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025

      Microsoft says Copilot can use location to change Outlook’s UI on Android

      June 2, 2025

      TempoMail — Command Line Temporary Email in Linux

      June 2, 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.

    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

    How Red Hat just quietly, radically transformed enterprise server Linux

    June 2, 2025
    News & Updates

    OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

    June 2, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    An exploration of the pain points that CSS gap solves.

    Development

    Discovery of Mysterious ‘Dark Oxygen’ on the Sea Floor: Is Earth in Danger?

    Artificial Intelligence

    CVE-2025-4052 – Google Chrome DevTools Authorization Bypass

    Common Vulnerabilities and Exposures (CVEs)

    Write for Us – Technology, Business & Marketing

    Development

    Highlights

    Development

    Valve has quietly removed Palworld’s Steam Deck ‘playable’ status

    January 3, 2025

    Palworld’s Steam Deck compatibility status has changed overnight from ‘Playable’ to ‘Unsupported,’ despite the game…

    4 ways you can take advantage of Google’s expanded shopping tools this summer

    June 24, 2024

    Meet &AI: An AI-Powered Platform that Streamlines Patent Due Diligence

    July 8, 2024

    25+ Best Mardi Gras Templates: Masks, Flyers, Invitations & More

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

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