php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63688 setlocale() fails on TS build
Submitted: 2012-12-04 17:41 UTC Modified: 2013-02-14 14:56 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: ab@php.net Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ab@php.net
New email:
PHP Version: OS:

 

 [2012-12-04 17:41 UTC] ab@php.net
Description:
------------
CLI TS build fails to set the locale

The relevant place in the code seems to be this:

http://lxr.php.net/xref/PHP_5_3/main/SAPI.c#82

Extending this code right in place like

_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)
setlocale(LC_ALL, "german");
lcnv = localeconv();
lcl = _get_current_locale();

and checking then *lcnv->decimal_point == ',' results in false. As well other values of the lconv scruct don't correspond to the set locale (german in this case).

_configthreadlocale()is not invoked in the NTS builds and setlocale works correct there.




Test script:
---------------
Those two tests

tests\lang\034.phpt
tests\lang\bug30638.phpt

a simpler test case

<?php
echo setlocale(LC_NUMERIC, 'german') . "\n";
echo (float)'3.14\n';

Expected result:
----------------
German_Germany.1252
3,14

Actual result:
--------------
German_Germany.1252
3.14

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-09 19:46 UTC] charnad at gmail dot com
Bug can be reproduced on all thread safe versions above 5.3.5 (5.3.6 - 5.4.9 for 
the moment) in CLI mode. 

Bug does not reproduce on all non-thread safe versions.
 [2013-02-14 14:56 UTC] ab@php.net
-Status: Open +Status: Wont fix
 [2013-02-14 14:56 UTC] ab@php.net
looks like this isn't fixable in PHP
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 21:01:35 2024 UTC