|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4235 Problem with setlocale
Submitted: 2000-04-25 12:30 UTC Modified: 2000-04-28 17:23 UTC
From: zzed at cyberdude dot com Assigned:
Status: Closed Package: Other
PHP Version: 4.0 Release Candidate 1 OS: Debian Linux 2.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: zzed at cyberdude dot com
New email:
PHP Version: OS:


 [2000-04-25 12:30 UTC] zzed at cyberdude dot com
Is there any special reason for setting only LC_CTYPE and not LC_ALL in
main.c? The problem now is that setlocale(LC_ALL, "") is, in fact, how the
locale is reset after the user has changed it with the PHP function
'setlocale' (this is done in PHP_RSHUTDOWN_FUNCTION(basic),
So if I change the locale settings with 'setlocale' in a script, when
the script is finished the locale settings for the Apache process wont
necessary be the same as before the script was run.

One side effect of this is that one process can get different locale
settings then the others. This makes (how I first noticed the problem)
repeated execution of a simple script like this

<?php print(setlocale(LC_ALL, 0)) ?>

produce varying (random, sort of) results. The results here depends of
course on which process happened to serve the request.

Possible fix:

--- main.c.orig Wed Apr 19 23:43:34 2000
+++ main.c      Wed Apr 19 23:43:53 2000
@@ -837,7 +837,7 @@
        PG(connection_status) = PHP_CONNECTION_NORMAL;
-       setlocale(LC_CTYPE, "");
+       setlocale(LC_ALL, "");
 #ifdef PHP_WIN32


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-04-28 17:22 UTC] thies at cvs dot php dot net
fixed in CVS
 [2000-04-28 17:23 UTC] thies at cvs dot php dot net
fixed in CVS
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 19:01:33 2024 UTC