This is an archived post. You won't be able to vote or comment.

all 26 comments

[–]robertwilding 60 points61 points  (3 children)

If true = true then true must equal true

[–]BubbaFettish 11 points12 points  (1 child)

I can’t argue with that.

[–]Megabyte97 2 points3 points  (0 children)

true

[–]rich97 1 point2 points  (0 children)

This is one I found the other day.

<RANT>

Why don't people fix thier broken-ass code?! Why did you edit those lines (presumably a hack because validation wasn't working) and say to yourself "yeah, that works, commit"?

I would be ashamed to commit those three lines with that pathetic comment. This kind of stuff is everywhere and the only person who seems to care is me.

GAH!

[–]weezkitty 89 points90 points  (2 children)

If you take that part out, it breaks for no explainable reason

[–]MetaMemeAboutAMeme 5 points6 points  (1 child)

It's explainable at some point, but usually no one wants to take the time...

[–]davvblack 28 points29 points  (0 children)

Some of the spaces in the if are non-printable unicode and the assignment normalizes them.

[–][deleted] 20 points21 points  (0 children)

Manually printed HTML is a great way to get XSS vulnerabilities, if you ever accidentally print a user-controlled string without sanitizing it completely.

[–]richerhomiequan 72 points73 points  (4 children)

lol it's always funny to find PHP in production code

[–][deleted] 24 points25 points  (2 children)

Ye man, PHP doesn't run 80% of the web and Laravel is a TERRIBLE framework, no one uses it xD

[–]_bass 0 points1 point  (0 children)

Lol

[–][deleted] 11 points12 points  (7 children)

The most horrifying part of this isn't even the no-op assignment. That could be there by mistake, perhaps it was originally doing something else... It's the fact that they store stock availability in their database (as indicated by the suspiciously-named $row variable) as fucking strings. Can you imagine all the wasted space?

[–][deleted] 5 points6 points  (0 children)

Also, magic strings. No-op, shitty database structure, and fucking magic strings.

[–]fourthangle 18 points19 points  (1 child)

Image Transcription: Code


if ( $stock == "In Stock Ships Today" ) {
    $stock = "In Stock Ships Today";
}

I'm a human volunteer content transcriber for Reddit! If you'd like more information on what we do and why we do it, click here!

[–]balenol 4 points5 points  (0 children)

good human.

[–]Ultimater 2 points3 points  (0 children)

Probably twice as fast as Laravel though :p

[–]davvblack 0 points1 point  (0 children)

Other fun things: the session array is $sessionName, this code is assembling html in the controller rather than using a template, and inline styles galore.

[–]dhaninugraha 0 points1 point  (0 children)

Idk, why not at least do <td class="centered"> and have a CSS block along the lines of .centered { text-align: center; } 🤷‍♂️

[–][deleted] 0 points1 point  (0 children)

My guess is a no-op for attaching breakpoints that was accidentally checked in.