PHP Manual Masterpieces

RSS
Mar 5

I am so comically angry right now

Hey uhh so strcmp() huh pretty simple I mean what could be simpler

Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

Pretty straightforward right how could this possibly be messed up it’s freaking strcmp either the strings are equal or they ain’t right

http://danuxx.blogspot.co.uk/2013/03/unauthorized-access-bypassing-php-strcmp.html

GODS FREAKING DARN IT ALL TO HECK.

This is why I hate you, PHP! This is why I consider you an unmitigated failure, a pox on the good name of programming! 

Dear language designer, pick one:

  • A language with a very casual typing system;
  • A language with standard API functions that cannot return an error indicating incompatible types were passed at runtime.

NOT BOTH. YOU CAN’T HAVE BOTH.

When I shared this on Twitter, legions of people showed up to say it was the programmer’s fault for using strcmp(). Riddle me this: is strcmp() part of the standard PHP API? Yes. Is it deprecated? No. Are there any caution notes in the official documentation? No. I don’t care how hard you try to blame the programmer, this is fundamentally bad language design. It’s a trap.

You can easily cut yourself on the standard API of many languages. The difference is that languages like C are labeled “sharp knife” and PHP is labeled “child-safe scissors.” Cutting yourself should not be this easy.

Dear sweet merciful angels I want to stab this language, twist the knife, yank out its still-beating heart and smash it against a rock.

 (╯°□°)╯︵ ┻━┻  0xabad1dea OUT.