From: xrstf-misc at yahoo dot com Operating system: Windows 7 x64 PHP version: 5.5.0 Package: *General Issues Bug Type: Bug Bug description:setting locale randomly broken
Description: ------------ I am experiencing trouble setting the locale (with setlocale(LC_ALL, ...)) in my code. With PHP 5.4, it always worked as expected, with 5.5 it appears that the locale has been changed, but localeconv() is still returning old values and functions like printf('%f') do not behave as expected. I have disabled the new Opcache, but the random behaviour persisted. I can't tell when it happens and why it sometimes doesn't work. It seems (to me) that there is some kind of threading problem, as I can have the same code in different browser tabs and get different results. I am using PHP 5.5.0 VC11 TS x86 on Windows 7 x64, loaded as a module into my Apache 2.4.3, which is running as a service. Test script: --------------- <?php function test($locale, $value) { $newlocale = setlocale(LC_ALL, $locale); $conv = localeconv(); $sep = $conv['decimal_point']; printf("%s\n--------------------------\n", $newlocale); printf(" sep: %s\n", $sep); printf(" %%f: %f\n", $value); printf(" %%F: %F\n", $value); printf("date: %s\n", strftime('%x')); printf("\n"); } test('german', 3.41); test('english', 3.41); test('french', 3.41); test('german', 3.41); Expected result: ---------------- German_Germany.1252 -------------------------- sep: , %f: 3,410000 %F: 3.410000 date: 10.07.2013 English_United States.1252 -------------------------- sep: . %f: 3.410000 %F: 3.410000 date: 7/10/2013 French_France.1252 -------------------------- sep: , %f: 3,410000 %F: 3.410000 date: 10/07/2013 German_Germany.1252 -------------------------- sep: , %f: 3,410000 %F: 3.410000 date: 10.07.2013 Actual result: -------------- German_Germany.1252 -------------------------- sep: . %f: 3.410000 %F: 3.410000 date: 10.07.2013 English_United States.1252 -------------------------- sep: . %f: 3.410000 %F: 3.410000 date: 7/10/2013 French_France.1252 -------------------------- sep: . %f: 3.410000 %F: 3.410000 date: 10/07/2013 German_Germany.1252 -------------------------- sep: . %f: 3.410000 %F: 3.410000 date: 10.07.2013 -- Edit bug report at https://bugs.php.net/bug.php?id=65230&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65230&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65230&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65230&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65230&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65230&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65230&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65230&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65230&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65230&r=support Expected behavior: https://bugs.php.net/fix.php?id=65230&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65230&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65230&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65230&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65230&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65230&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65230&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65230&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65230&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65230&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65230&r=mysqlcfg