Live data from Hacker News

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

bugs.php.net

81–90 of 135 posts

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

#81
post #11

PHP is a big legacy open source project, worked on by many volunteers whenever they can spare the time, just like any other open source project. It is wildly successful despite this and many other bugs. I only wish that the people who spend as much time attacking PHP and it's developers endlessly would instead focus some of that energy into helping to improve PHP, but I guess some of us are just negatively charged. S…

I'd rather spend my time making good languages better than making awful languages ever so slightly less awful.

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

#82
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.

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

#84
post #44

If there are so many people depending on PHP and all the code written in PHP in all of Turkey, why doesnt someone in Turkey fix the problem? Or anywhere for that matter? There is no "they" in this equation. There is no person who should be held more accountable than you or I for fixing this problem. The choices are simple: 1) Fix the problem 2) Find a work around 3) Don't use PHP What's that? There is a lot of open s…

You are the only reasonable voice on the matter I've heard so far. Infinite upvotes from me. We all know PHP has its shortcomings, but there appears to be a witch hunt going on here.

We all know PHP has its shortcomings, but there appears to be a witch hunt going on here.

I think some of the witch hunt comes in attempt to steer people away from a language which is badly designed and has a million bugs which cannot be fixed without breaking most of the existing code written for the language.

Pestering a language like that is only fair.

While I'm sure it gets tiresome for those who for whatever reason have to work or prefer working in PHP, it is only a polite gesture to the software-developers who has yet to take that dark path.

If they can be dissuaded, they should.

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

#85
post #75
post #51

Earlier quoted context omitted.

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.

Doesn't look like that from the bug report; there the locale is set first, then the class is defined and then looked up.

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

#86

Earlier quoted context omitted.

Unfortunately, the obvious answer (parse code in the C locale) breaks code that's in the wild and relies on PHP's undocumented locale-specific case-insensitivity. Obviously, case-insensitive identifiers are a bad idea, but PHP is stuck with them at this point.

I don't think it's "obvious" at all. The problems caused by case sensitive identifiers are legion, especially in dynamic languages with implicit declaration. It's not at all clear to me that this problem is of case insensitive identifiers and not simply in PHP's implementation.

Changing the case insensitivity of PHP identifiers is a good idea. I suspect breakage would be minimal and easily fixable. One has to keep in mind that variable names are already case sensitive in PHP, and most (reasonably good) code I've seen in the wild does honor the spelling of class and method names.

Of course it will never happen, but I really think this would be a great idea for the next major version. Backwards compatibility is important but not at all costs. A language needs to remain agile enough to allow for the recognition of (and ultimately the fixing of) mistakes.

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

#87
post #74

Earlier quoted context omitted.

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...

Which would not help in this case, since in turkish the upper-case representation of `i` is not `I` but a different symbol. So the class you're looking for would not exist.

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

#88
post #86

Earlier quoted context omitted.

I don't think it's "obvious" at all. The problems caused by case sensitive identifiers are legion, especially in dynamic languages with implicit declaration. It's not at all clear to me that this problem is of case insensitive identifiers and not simply in PHP's implementation.

Changing the case insensitivity of PHP identifiers is a good idea. I suspect breakage would be minimal and easily fixable. One has to keep in mind that variable names are already case sensitive in PHP, and most (reasonably good) code I've seen in the wild does honor the spelling of class and method names. Of course it will never happen, but I really think this would be a great idea for the next major version. Backwar…

I doubt that breakage would be minimal. I'm not as certain as you that most code does honor the spelling of class and method names, but even if we assume that this is the case I'd assume that there are tons of undetected errors. Currently, there's just no way to test that you're using the proper spelling, so nobody does.

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

#89
post #86

Earlier quoted context omitted.

Changing the case insensitivity of PHP identifiers is a good idea. I suspect breakage would be minimal and easily fixable. One has to keep in mind that variable names are already case sensitive in PHP, and most (reasonably good) code I've seen in the wild does honor the spelling of class and method names. Of course it will never happen, but I really think this would be a great idea for the next major version. Backwar…

I doubt that breakage would be minimal. I'm not as certain as you that most code does honor the spelling of class and method names, but even if we assume that this is the case I'd assume that there are tons of undetected errors. Currently, there's just no way to test that you're using the proper spelling, so nobody does.

It would be trivial to write a command line tool to check (and maybe automatically fix) those typos. Incorporating it into a major new version also ensures everybody has enough time to prepare - and in case of hopeless and unfixable legacy apps: there is always the option not to upgrade.

Breaking changes in programming languages are not that uncommon, C# and Perl spring to mind from personal experience, but also to a lesser degree such things have happened with PHP itself (and it became better for it). In this case, it's actually a change that moves the runtime's behavior closer to what's expected. It's a change that improves internal consistency while also eliminating silly bugs like the one discussed here.

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

#90
post #11

PHP is a big legacy open source project, worked on by many volunteers whenever they can spare the time, just like any other open source project. It is wildly successful despite this and many other bugs. I only wish that the people who spend as much time attacking PHP and it's developers endlessly would instead focus some of that energy into helping to improve PHP, but I guess some of us are just negatively charged. S…

I stopped using PHP years ago because their open-source community is a broken insider network. After wasting a few bug reports repeatedly arguing with certain core developers who took the position that code and documentation not being in sync wasn't a bug, I quit trying.
Post reply on HN