Hacker News new | ask | show | jobs
by lonnyk 5096 days ago
> 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

2 comments

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.