note 65240 rejected from function.setlocale by bjori
| From: | bjori@php.net | Date: | Thu, 27 Apr 2006 13:02:30 +0000 |
| Subject: | note 65240 rejected from function.setlocale by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109854@lists.php.net to get a copy of this message | ||
Note Submitter: acolomb at web dot de
----
I've had problems with PHP not recognizing decimal numbers when run under Windows XP with
german locale. The following code explains the problem:
<?php
$a = 1.5;
$b = (float) "1.5";
$c = (float) "1,5";
echo "a:$a; b:$b; c:$c";
?>
It returned "a:1; b:1, c:1,5"
When setting the decimal point character in Windows Control Panel (Regional settings) to
".", it returned "a:1.5; b:1.5; c:1".
Setting the locale via setlocale(LC_NUMERICAL, "en") only had an effect on the number
output.
It seems to be a problem with the php_gtk.dll extension. When I commented out the
extension=php_gtk.dll line in php.in, the output was as expected. Apparently the php_gtk extension
imports the locale settings from Windows, but also changes something in the PHP engine to not accept
"." as a decimal point in source code anymore.
Tested with php-gtk 1.0.1a and php 4.3.9-dev
It seems to be fixed when using php-gtk 1.0.2 and php 4.4.1-dev