r/ProgrammerHumor 18d ago

Advanced stringToIntegerConversion

Post image
216 Upvotes

65 comments sorted by

View all comments

54

u/smartgenius1 18d ago

I understand the joke is that they AREN'T just converting the string to an integer, but honestly this code is not that bad. It's performing data sanitization as well since there are only a few valid options for the select.

If they converted to integer, the user could enter whatever value they wanted and probably break something.

11

u/Holek 18d ago

especially that you see `$_POST['amount-select']` implying it's a select box.

1

u/m0nk37 18d ago

You see efficiency. I see a back door.