|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-02-14 10:11 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 15:00:02 2025 UTC |
Description: ------------ The Zend engine does not respect the current locale when it converts from a string to a float. Zend assumes that all numbers have a "." as a decimal seperator. This is not the case in many parts of the world. Included in this bug is a bit of "non-portable" code that solves the problem. This may not be the most elegant solution but it illustrates what needs to be fixed. Here are my changes to Zend/zend_strtod.c at line 1249: // CONST char decimal_point = ','; char decimal_point = '.'; #ifdef HAVE_LOCALE_H struct lconv* current_locale; current_locale=localeconv(); decimal_point=(*(*current_locale).decimal_point); #endif Reproduce code: --------------- <?php setLocale(LC_ALL,"de_DE"); echo ("2,2"*2)."\n"; ?> Expected result: ---------------- The result one would expect if PHP respected locale: 4,4 Actual result: -------------- What you get is: 4