Live data from Hacker News

PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

bugs.php.net

71–80 of 135 posts

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#71
post #20

I think this was a good explanation: "No, the problem results because lowercase i (in most languages) and uppercase I (in most languages) are not actually considered to be the upper/lower variant of the same letter in Turkish. In Turkish, the undotted ı is the lowercase of I, and the dotted İ is the uppercase of i. If you have a class named Image, it will break if the locale is changed to turkish because class_exists…

But, why should the locale change the way PHP code is interpreted? Shouldn't LC_ALL="C" when parsing the code? Maybe it breaks if you embed unicode strings or something. What do other languages do?

Just using LC_ALL="C" would break people using some other language to write code. I personally strictly disagree with writing code in anything but English, but other people think it's okay to have Russian class names or something. Using LC_ALL="C" would make this impossible.

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#72
post #36

Earlier quoted context omitted.

> After 5+ years of eloquent, smart programmers* posting long, well researched screeds about what's deeply broken with PHP's design at the most fundamental levels, there is no other conclusion to be reached. Issuing holy decrees from their ivory towers more like. Meanwhile, lots of tremendously successful companies doing real work in PHP each and every day, at the coal face, where it matters. Does their hard work des…

It seems to me that the kicker is the obviously superior alternatives, such as python, ruby, and JavaScript, don't offer the ease of deployment that php has via mod_php, and instead insist on the developer writing a web server. While there are advantages (performance, control) to the web server approach it is clear that there are advantages (simplicty) to being able to stick code snippets in web pages. If you could d…

> If you could deploy (say) python-decorated web pages via apache

This is a terrible, terrible idea. There are a few Python frameworks which have tried similar things, but Model-View-Controller was invented for a reason.

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#73
post #66
post #36

Earlier quoted context omitted.

> After 5+ years of eloquent, smart programmers* posting long, well researched screeds about what's deeply broken with PHP's design at the most fundamental levels, there is no other conclusion to be reached. Issuing holy decrees from their ivory towers more like. Meanwhile, lots of tremendously successful companies doing real work in PHP each and every day, at the coal face, where it matters. Does their hard work des…

> Does their hard work deserve this constant ridicule? Nobody seriously criticizing PHP is ridiculing people working with it. On the contrary, I personally applaud people having to, and succeeding at extracting diamonds with a broken pickaxe. > The problem is, many "eloquent, smart programmers" are too busy "posting long, well researched screeds" to spend some time making PHP better (or making a better PHP). A "bette…

> Nobody seriously criticizing PHP is ridiculing people working with it.

I rarely see this. I've found it hard to find a good criticism of PHP that doesn't find a way to insult it's user base.

Probably the best criticism of PHP has come from Jeff Atwood's recent post[1] (and even he couldn't go the post without slinging immature, and downright vulgar insults).

1. http://www.codinghorror.com/blog/2012/06/the-php-singularity...

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#74
post #35

Earlier quoted context omitted.

Well, VB.NET is case insensitive yet the problem doesn’t crop up there because it’s not braindead enough to use the same locale while compiling & executing. Yes, I get that PHP code isn’t compiled in a separate step but there still is no reason for it to use a user-defined locale. It should use the C locale, end of story. I don’t understand why this isn’t trivial to fix. Is there any place where PHP depends on a user…

Class names can crop up during execution as well though. This is valid PHP: $classname = $row_I_got_from_mysql['classname']; $object = new $classname; I'm sure this can still be solved though. It's not trivial, but it's not "takes over 9 years to fix" complex either.

PHP could just use the approach NTFS uses on Windows and convert to upper case instead:

http://blogs.msdn.com/b/michkap/archive/2004/12/02/273619.as...

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#75
post #51

Earlier quoted context omitted.

If it wasn't clear by the comments on the bug report or by the quoted sections of this comment's parent, let me rephrase it. This issue is entirely caused by the fact that PHP is case insensitive for classes and function names (but not variables, go figure). That is, if you define a class MyClass, you can instantiate it using MyClass or myclass or MYCLASS. You can call the functions from the standard library in whate…

That still doesn't make sense. If 'i' is not the lowercase equivalent of 'I', then the lowercasing should just result in another letter, right? The only thing that could cause the bug is if it uses two different ways of lowercasing (perhaps one when registering the class, and another way when looking up the class). The mapping between uppercase and lowercase can be completely arbitrary, and as long as it's used consi…

The issue only occurs when the locale is changed between registering and looking up the class.

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#76
post #53

Earlier quoted context omitted.

I know it seems insane, but Turkish capitalization is not fun to work with as a programmer. When they latinized the alphabet 100 years ago or so, they were short on vowels and so it must have seemed pretty clever and convenient to make i and I separate letters with İ and ı respective case pairs. From a western programmers perspective though it's one of the worst unicode special cases owing to its combined unexpectedn…

From my point of view there could be one very simple solution: just add new codepoints in unicode for turkish I and i. So the latin i would follow the common case conventions, and turkish i would use whatever crazy stuff they have there. Of course that might be bit late to do now, there is probably too much text encoded in the current format.

It's probably a bit late, agreed, but it seems to me this problem is just as much the fault of the encoding itself as it is the fault of PHP : Turkish i and I may look like Western European i and I but they're entirely different characters.

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#78
post #36

Earlier quoted context omitted.

> After 5+ years of eloquent, smart programmers* posting long, well researched screeds about what's deeply broken with PHP's design at the most fundamental levels, there is no other conclusion to be reached. Issuing holy decrees from their ivory towers more like. Meanwhile, lots of tremendously successful companies doing real work in PHP each and every day, at the coal face, where it matters. Does their hard work des…

It seems to me that the kicker is the obviously superior alternatives, such as python, ruby, and JavaScript, don't offer the ease of deployment that php has via mod_php, and instead insist on the developer writing a web server. While there are advantages (performance, control) to the web server approach it is clear that there are advantages (simplicty) to being able to stick code snippets in web pages. If you could d…

I don't know any rails developer who has written a web server, where did you get that idea? Many use mod_rails via nginx or apache:

http://www.modrails.com/

Also, PAAS offerings like Heroku and Engine Yard make deploying sophisticated rails environments far more convenient than their PHP equivalent.

> "sticking code snippets in web pages"

You can do exactly this in ruby with ERB, but many shy away from this approach due to a distaste for the bolognaise pattern.

You should try ruby/rails/sinatra on your next project, it will change your life.

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#79

I don't understand what's the problem with fixing this really. I would completely agree that making "Info" and "info" class names compatible is "not fixable", but what is the problem in making "Info" work if both the definition and usage are the same case? The bug says that this is exactly backwards - mixed case works, but same case doesn't. The only way to make it not work is to first change the case in one locale a…

[deleted]

Re: PHP Bug #18556 : Setting locale to 'tr_TR' lowercases class names

#80
post #66

Earlier quoted context omitted.

> Does their hard work deserve this constant ridicule? Nobody seriously criticizing PHP is ridiculing people working with it. On the contrary, I personally applaud people having to, and succeeding at extracting diamonds with a broken pickaxe. > The problem is, many "eloquent, smart programmers" are too busy "posting long, well researched screeds" to spend some time making PHP better (or making a better PHP). A "bette…

> Nobody seriously criticizing PHP is ridiculing people working with it. I rarely see this. I've found it hard to find a good criticism of PHP that doesn't find a way to insult it's user base. Probably the best criticism of PHP has come from Jeff Atwood's recent post[1] (and even he couldn't go the post without slinging immature, and downright vulgar insults). 1. http://www.codinghorror.com/blog/2012/06/the-php-singu…

That's exactly what I'm talking about, it's insulting and it disappoints me that all of the recent HN threads have been full of similar insults. Their arguments always seem to boil down to "my hammer is better than your hammer, and you're an idiot for choosing the wrong hammer, but luckily I am here to re-educate you".
Post reply on HN