79820371

Date: 2025-11-14 19:16:48
Score: 0.5
Natty:
Report link

On Windows the C runtime that PHP uses for locale handling does not validate locale names against any real list. It only checks the general pattern of the string. As long as the part before the dot is short enough, the call succeeds even if that locale does not exist at all.

When this happens Windows simply keeps the system default locale for every actual formatting function. That is why date output stays in English even though PHP reports that the locale was set to the exact string you passed in.

If you try a string that does not match the expected pattern, for example something with more than three letters before the dot, the call fails and PHP returns false. That is the only point where you notice that Windows rejected it.

To get real locale changes on Windows you need to use the Windows specific locale names such as English_United States with the correct code page. Only those names cause Windows to switch to a real locale and affect formatting output.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Hunt3r5o4