22

4 hours! four fucking hours! f.o.u.r. h.o.u.r.s.!
It's the amount in the time domain this bug has cost me to fix. The cost in the sanity domain is immeasurable...
I swear, the god damn ass births of devs who coded this abomination should be slowly mutilated and then raped by their own severed limbs.
It took me 4 hours to figure out that their 12 year old binary CLI tool they used to generate PDFs from PHP could not handle neither HTML5 nor some linebreaks at specific places. Some part of it is due to them using REGEX to find and replace HTML tag.
Yes, I am indeed very pissed. And I need a 🥃 or 3

What we learned:
- Don't use REGEX to "parse" HTML
- Don't call random compiled CLI tools from PHP if there are PHP packages to do the same shit

Comments
  • 11
    If you or your coworkers were trying to parse HTML using Regexs you need to view the top stackoverflow answer at this post.

    https://stackoverflow.com/questions...

    In conclusion you cannot parse HTML with Regexs and if you try to do so you should be publicly flogged for the doom you have brought upon collective humanity.
  • 11
    Four hours is a good time for investigating an obscure bug in a code base you aren't familiar with.
  • 4
    @adhdeveloper He comes!

    Regex can be used for a quick and dirty non production use, but limited - say, small scraper script.
    but for any production code - use an html/xml parser.
  • 1
    @adhdeveloper Yeah, parsing HTML with Regex has been kind of a meme for some years now. lol

    @Oktokolo Damn, I've been working in this so called codebase for some 4 months now... thankfully I'm doing a completely new project besides maintaining this one. The new software is based on Azure Functions / Micro Services and so clean that it feels like heaven compared to this dreadful abyss of pain.
    Only 4 more months
  • 2
    @PonySlaystation

    When you stop asking: How could it get worse...

    Because you realized that it *must* get worse - after all, this couldn't be everything - kinda like a boss fight in a game that is too suddenly over and your brain screams paranoia.

    I guess you reached that point?
  • 2
    @adhdeveloper As it is often the case on StackOverflow: Don't stop at the top answer. Read further to get the bigger picture.
  • 1
    @PonySlaystation Some code bases take longer to become familiar with...
  • 1
    Bro, similar situation I saw the other day. The PHP class was 1000 lines long with all functions concatenating 100’s of divs. I want to know how these people think.
  • 1
    @phat-lasagna fuck 😣
Add Comment