php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47451 setlocale() ignores setting
Submitted: 2009-02-19 16:04 UTC Modified: 2009-02-20 09:33 UTC
From: szoftos at freemail dot hu Assigned:
Status: Not a bug Package: Gettext related
PHP Version: 5.2.9RC2 OS: FreeBSD 7.0
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: szoftos at freemail dot hu
New email:
PHP Version: OS:

 

 [2009-02-19 16:04 UTC] szoftos at freemail dot hu
Description:
------------
Hello,

on BSD systems, setlocale itself is not usable for gettext without putenv(). If I don't use putenv() with setlocale() (which is not enabled by default in safe_mode for $LANG), my own translations are not useable with gettext.

Since i use safe_mode, I'd not prefer enabling the setting of $LANG variablewith putenv(). What I've seen during php ktracing, is that setlocale() only reads the original language settings from /usr/share/locale/*, but my own translations are not looked up.

Is there any way to fix that functionality? Maybe it's more BSD related than I think.

Reproduce code:
---------------
You can simply try the gettext module's own tests to test it in BSD. They all will fail, because those tests aren't usint putenv().



Expected result:
----------------
I expect not to use the putenv() with safe_mode=on :)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-19 21:45 UTC] jani@php.net
If you can't use putenv() then you need to set the environment 
variables prior to running PHP / starting the webserver. No bug here.
 [2009-02-20 09:27 UTC] szoftos at freemail dot hu
Yeah, but what if you would like to change your language on the fly, like changing languages on your site? And that's just one virtualhost, what if every virtualhost would like to use another setting of $LANG ... ?
 [2009-02-20 09:33 UTC] szoftos at freemail dot hu
I think this is still a bug, and not a bogus one.

For your translation to use, you HAVE to set the correct $LANG variable _runtime_. When you are using more than one translation, and would like to change translations on the fly, $LANG variable has to be changed to the apropriate setting each time.

Without that, translations will not work with gettext.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC