Hacker News new | ask | show | jobs
by mikeash 5095 days ago
Every time an article critical of PHP appears, defenders come out of the woodwork. It's a great language, they say. It's no more flawed than any other language. Critics are just biased. It has problems, but other languages have problems too. People build large apps with PHP, so it must be good.

But come on. This language is complete crap. Code spontaneously fails depending on the locale? And the bug has been open for ten years and still is not fixed? And this is only one bizarre and inexplicable bug out of hundreds, maybe thousands, of bizarre and inexplicable bugs in PHP.

This language isn't defensible. If you want to say that it's worth dealing with the flaws due to the ecosystem, fine, fair enough. But don't tell us that PHP is no worse than any other language. It's far worse.

3 comments

Of course, this isn't an article critical of PHP and I'm sure those defenders would just as readily state 'every time PHP appears on Hacker News the PHP-haters come out."

While I tend to agree that I would not use PHP for new projects, I would disagree that it's indefensible. All you need to defend it is, "it's easy." In the sense of, "it's nearby, it's within reach." If it happens to be the language installed on your system, its use is automatically defensible on those grounds alone.

It might not nurture you and love you and cherish you; hell, it may abuse you at times, as any language with idiosyncrasies does. It might even have more idiosyncrasies than other languages do. But those do not make a relationship indefensible -- merely difficult. And in some cases, the difficulty makes the love even more binding -- which is why we still have people who program in low-level languages, for example, even though those have all the more tendency to abuse you for the tiniest mistake you make.

The choice to use PHP may be defensible. The PHP ecosystem may be. But I don't believe the language itself is. It's a subtle but important distinction: there are some good reasons to use PHP (although IMO more good reasons not to), but there are few or no good reasons for PHP's problems.
> Code spontaneously fails depending on the locale?

It doesn't spontaneously fail. The languages functions are case-insensitive and they documented this. [1] [2] When you change the locale to Turkish the letters change. Thus, the class name changes and no longer works as expected.

So it is documented because it may not as expected, but it is not spontaneous.

[1] http://www.php.net/manual/en/functions.user-defined.php

[2] https://gist.github.com/3033533

That's incorrect. It's not behaving as documented. Whether you compare in a case-sensitive or case-insensitive way "Info" should always match "Info". The bug results in a situation where it doesn't.

I'd accept that you cannot reference class "info" using name "Info" in Turkish locale, but that's not the case here.

Nowhere in your documentation does it state that a class name cannot be accessed using the exact same, byte-for-byte identical name, depending on locale.

Case sensitivity changing depending on locale would be weird, but at least vaguely sensible. Identical strings no longer matching is just plain wrong.

  > Code spontaneously fails depending on the locale?
Code spontaneously hangs when converting 2.2250738585072012e-308? Now count how many languages were affected by that.
How many affected languages left it unfixed for a decade and counting?