php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39305 Use of decimal point in different countries
Submitted: 2006-10-30 11:16 UTC Modified: 2016-08-11 15:04 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: steinm@php.net Assigned: cmb (profile)
Status: Closed Package: dbase (PECL)
PHP Version: 5.1.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: steinm@php.net
New email:
PHP Version: OS:

 

 [2006-10-30 11:16 UTC] steinm@php.net
Description:
------------
As far as I know the dbase format, there is no way to specify the character for a decimal point in float values. Since the dbase format stores the float as a string, one can either use '.' or ',', though I'm not sure if ',' is really a valid option.

The dbase extension uses the setting from the current locale, which results on my system (german) to ',' as a decimal point. Those files cannot be read by e.g. gnumeric of oocalc which always expect '.'.

I propose to always use '.'.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-10 17:44 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Package: Feature/Change Request +Package: dbase -Assigned To: +Assigned To: cmb
 [2016-08-10 17:44 UTC] cmb@php.net
This is clearly a bug rather similar to bug #52112. The culprit
is convert_to_string(_ex) which is locale dependend.

And it's even worse, because %G is used internally, so e.g.
`10e20` ends up as `1,0E+21`.

I guess we can use _php_math_number_format_ex() from
ext/standard/math.h instead.
 [2016-08-10 18:13 UTC] cmb@php.net
-Type: Feature/Change Request +Type: Bug
 [2016-08-11 14:46 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339853
Log: Fix #39305: Use of decimal point in different countries

We're going to use _php_math_number_format_ex() instead of
snprintf() when writing double values to a DBF to avoid any locale
specific behavior.
 [2016-08-11 14:53 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339854
Log: Merged revision(s) 339852-339853 from pecl/dbase/branches/dbase-5.1:

Fix #39305: Use of decimal point in different countries

We're going to use _php_math_number_format_ex() instead of
snprintf() when writing double values to a DBF to avoid any locale
specific behavior.
 [2016-08-11 15:04 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2016-08-11 15:04 UTC] cmb@php.net
The fix for this bug has been committed.

Thank you for the report, and for helping us make PHP better.
 [2016-10-27 13:10 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=340740
Log: Mark PHP 5.4+ requirement

The fix for bug #39305 uses _php_math_number_format_ex(), which is only
available as of PHP 5.4. Unfortunately, we can't use
_php_math_number_format() instead, so we require PHP 5.4+ for dbase
5.1.1+. Shouldn't be much of problem, though, as PHP 5.3 has EOL'd long
ago.
 [2021-04-06 10:18 UTC] git@php.net
Automatic comment on behalf of 
Revision: https://github.com/php/pecl-database-dbase/commit/820bcb2d00db911ee7a596aef3d079db7a2b7d4b
Log: Merged revision(s) 339852-339853 from pecl/dbase/branches/dbase-5.1:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC