You can't imagine how many lines of pure and utter horseshit, seemingly written in PHP, I had to dig through this whole weekend. (relating to my 2 previous rants)

How is it even possible to write code this unbelievably ugly?

- includes within loops
- included files use variables from parent files
- start- and endtags separated to different files
- SQL queries generated by string concatenation, no safety measures at all (injection)
- repeating DB calls within loops
- multiple directories with the same code (~40 files), only different by ~8 lines, copied
- a mixture of <?php echo ... ?> and <?= ... ?>
- a LOT of array accesses and other stuff prefixed with "@" (suppress error messages)
- passwords in cleartext
- random non-RESTful page changes with a mixture of POST and GET
- GET parameters not URL-encoded
- ...

My boss told me it took this guy weeks and weeks of coding to write this tool (he's an "experienced dev", of course WITHOUT Git).

Guess what?
It took me only 20 hours and about 700 lines of code.

I must confess, since this task, I don't hate PHP anymore, I just simply hate this dev to death.

Addendum: It's Monday, 5:30am. Good night. 😉

  • 11
    What gonna happen to that dev? Tell me, something must happen to him, alright. If your boss won't take any action, we should. Nuke his house or sth.
  • 5
    Had shit like that. Couple of weeks ago the lead devel of my team gives me a rather large project that a developer had built before. Honestly it was not that bad, but I felt that the previous developer had little to no concept of writting code in an oop style, so his idea of abstraction was using includes to "modularize" stuff. At one point I reached a file that literally included an echo statement and nothing more(legit echo ("</div>")) and we still make fun of it to this day.
  • 5
    I get flashbacks from that, I usually just completely rewrite it, its really not worth it often to go through that garbage 😖
  • 7
    This is the stuff of nightmares.

    I can only hope you never have to deal with the horrors some “devs” leave behind again.

    Anyone that needs to use @ to mute an error should be shot on sight.

    The looping queries unless they return a different records data 🔫
  • 5
    @Bitwise, true there’s a very small % of use cases it’s forgivable for, but in general just to mute and error you can’t be bothered dealing with is more what I’m meaning.

    Like when you run @mysql_connect on php 5.6+ rather then making it mysqli / PDO
  • 3
    Is it wordpress or pure php?
    Thats looks like something not done in a proper framework
  • 3
    @WorstVarNames Only raw PHP, no framework...
  • 1
    Punch mothfkr in face with large writeCleanAndSafeCode punch
  • 3
    Wanna do a Secret Santa like Reddit for devrant?

    Instead of presents, we gonna send postcards of rants and curses to all those people anonymously. 🤔
  • 2
    It makes me feel good when I see this, because I know I'm good and people who get paid are shit.

    Hang in there, your one of the good ones.
  • 5
    Jesus Christ...

    Now this is what gives PHP a bad name, people who write shit like that. I had a guy ask me to review and comment his "MVC" framework once, and when I did it wasn't remotely close to being defined as one (or remotely close to any kind of "framework"), he then had the audacity to try and school me that PHP itself is the framework...🙄
  • 2
    @jesse-bryant Holy shit, that person must be really stupid! Wtf...
Add Comment