On Mon, 27 Dec 2004 22:48:31 +0100 I wrote:
I have been using Squirrelmail 1.4.2 on OpenBSD 3.5 (PHP 4.3.8) since May of 2004. Recently I got a report from a user saying that the language selection function no longer worked, except for the "Help" link. Unfortunately I didn't get this report until 2 or 3 weeks after the problem started occurring so I don't know what I might have done to cause it.
The change I had made was putting on safe_mode. I was then advised that somehow the setlocale call must be failing. Indeed, as I reported later, PHP's setlocale function does not seem to work on OpenBSD:
PHP's setlocale function seems to be not working. The following script:
<?php /* Set locale to Catalan */ setlocale(LC_ALL, 'ca_ES'); echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978)); ?>
... produces: Friday 22 December 1978
However, Horde/Imp's language function *did* work. So I looked in Lang.php and saw the following:
putenv('LANG=' . $lang);
putenv('LANGUAGE=' . $lang);
setlocale(LC_ALL, $lang);But SM's i18n.php won't do the putenv call if safe_mode is on:
if ( !ini_get('safe_mode') &&
getenv( 'LC_ALL' ) != $longlocale ) {
putenv( "LC_ALL=$longlocale" );
putenv( "LANG=$longlocale" );
putenv( "LANGUAGE=$longlocale" );
} putenv( "LC_ALL=$longlocale" );
putenv( "LANG=$longlocale" );
putenv( "LANGUAGE=$longlocale" );setlocale(LC_ALL, $longlocale);
So I simply pulled the 'putenv' calls out of the !ini_get loop:
if ( !ini_get('safe_mode') &&
getenv( 'LC_ALL' ) != $longlocale ) {
putenv( "LC_ALL=$longlocale" );
putenv( "LANG=$longlocale" );
putenv( "LANGUAGE=$longlocale" );
}
putenv( "LC_ALL=$longlocale" );
putenv( "LANG=$longlocale" );
putenv( "LANGUAGE=$longlocale" );setlocale(LC_ALL, $longlocale);
And all is now well. BTW, you must also include LANG and LANGUAGE in your safe_mode_allowed_env_vars:
My thanks to Tomas Kuliavas for his helpful comments.
-- All the best (Ad�u-siau), Lou Hevly [EMAIL PROTECTED] http://visca.com
------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt -- squirrelmail-users mailing list Posting Guidelines: http://squirrelmail.org/wiki/wiki.php?MailingListPostingGuidelines List Address: [email protected] List Archives: http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user List Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=2995 List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users
