11
C0D4
5y

So today was interesting.

I had to extract the domain from an email address and compare the domain to a hard coded whitelist, nothing difficult, fuck takes 2 min really.

Except the project starts throwing 500 errors for no god damn reason, like seriously, I double check syntax, nope looks fine, run pho's syntax checker on the file
# php -l /path/to/file.php

Nope says it's all good.
Checks error log on server -> no log

OoooooooooKay then.

Comments out the few lines, saves, errors gone.

remove comments, error comes back.

Do this a few times, and magically the fucking thing stops throwing errors, now I haven't actually changed anything, and I know this project is so fragile I don't know how it stays running at times but fuck me this is a painful joke.

Comments
  • 3
  • 1
    What about some unicode blank character in comments? In that case, the syntax checker wouldn't throw any warning since it's in a comment, but the PHP parser would explode
  • 1
    @crisz I wouldnt think so, there was nothing copied into it, plus vsCode has a non UTF8 character highlighter for when I have to deal with some of those shitty characters with csv's and what not.

    Good way to do a spot check before letting it through.

    I'd completely accept this project just being a pain in the ass.
  • 5
    in many php sites i worked on, something similar happened.

    i always imagined it's because when i modify a file and force the server to re-parse and re-cache it, it realizes it's running php and goes "FUCK NO, THAT'S A MISTAKE, 500, I REFUSE".

    but then after back and forth modifications for a few times, it goes "well... if you insist, i guess i have no other choice..."
  • 0
    @C0D4 how do you enable the no-UTF8 highlighter? I don't have it
  • 1
    @crisz there's a extension "highlight bad chars"

    It's not entirely non-UTF8 but it finds the common crap that is easy to miss.
Add Comment