PHP 4.0 Bug #2949: setlocale: scanner (scanf?) / printf don't work properly (cont. of bug #722)
| From: | php-bug at vogtner dot de | Date: | Fri, 10 Dec 1999 10:53:57 +0000 |
| Subject: | PHP 4.0 Bug #2949: setlocale: scanner (scanf?) / printf don't work properly (cont. of bug #722) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-13549@lists.php.net to get a copy of this message | ||
From: php-bug@vogtner.de
Operating system: UNIX
PHP version: 4.0 Beta 3
PHP Bug Type: Misbehaving function
Bug description: setlocale: scanner (scanf?) / printf don't work properly (cont. of bug #722)
The bug is still present in 4.0B3.
This code
<%
setlocale ('LC_ALL', "de_DE"); // or other locale with dec. sep = ,
$v = 3;
$v /= 4;
print $v;
echo $v;
printf ("%7.2f", $v);
echo "\n";
$z = 3.4;
echo $z;
echo "\n";
?>
yields:
Connection: close
Content-Type: text/html
0,750,75 0.75
3
the last line should read 3.4.
Additionally: The locale-state seems to be persistent
across two GETs of the respective script. There seems
to be a basic misconception of locales in a high level
language like PHP (Perl seemd to have the same problem
some time ago): You cannot simply call the C-function
setlocale!
Stefan