PHP 4.0 Bug #7626: session saving and loading seem to use different locales
| From: | cstrebin at softdevel dot com | Date: | Fri, 03 Nov 2000 17:19:28 +0000 |
| Subject: | PHP 4.0 Bug #7626: session saving and loading seem to use different locales | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-36986@lists.php.net to get a copy of this message | ||
From: cstrebin@softdevel.com
Operating system: Linux 2.2.14
PHP version: 4.0.0
PHP Bug Type: *General Issues
Bug description: session saving and loading seem to use different locales
My LANG environment variable is "german". At the beginning of every page, I do
setLocale('LC_ALL', 'en_US')'. With those settings, float session
variables are saved with ,' as decimal point, but loading seems to expect `.' so
that I get values truncated to ints.
Example script:
<?
setLocale('LC_ALL', 'en_US');
session_start();
$x = & $HTTP_SESSION_VARS['x'];
if (!isset($x)) $x = 1;
$x *= '1.1';
print("$x<br>\n");
printf("<a href=\"%s\">go</a>\n",
$HTTP_SERVER_VARS['PHP_SELF']);
// (link relies on transparent sid)
?>
The session file contains x|d:1,1;', and the page always shows 1.1', since
the loaded value becomes 1.
--
Edit Bug report at: http://bugs.php.net/?id=7626&edit=1