php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32868 Although localeconv() reports , for decimal_point calculations fail
Submitted: 2005-04-28 16:59 UTC Modified: 2005-04-28 17:56 UTC
From: andy at laut dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.10 OS: SuSe Linux 9.2
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andy at laut dot de
New email:
PHP Version: OS:

 

 [2005-04-28 16:59 UTC] andy at laut dot de
Description:
------------
There seems to be a failure in internal number formating. Although my locale is set correctly and localeconf returns the expected information, which says, that decimal_point is the komma, calculations with komma as decimal-separator fail. 

Versions of PHP <4.3 behave as i expect, but since 4.3 scripts which uses the komma for decimal-separator don't calculate correctly anymore...

My Configure-Line:

'./configure' '--with-apxs=/www/apache-1.3.33/bin/apxs' '--prefix=/www/apache-1.3.33/php-4.3.10' '--with-gd' '--with-zlib' '--with-mysql' '--enable-trans-sid' '--enable-ftp' '--with-mnogosearch=/www/mnogosearch' 

Reproduce code:
---------------
#As anybody can see here, the locale is set correctly
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 12, 22, 1978));

#localeconf returns the expected information
$locale_info = localeconv();
print_r($locale_info);

#But what the heck, this print doesn't
print("1,00+1,99=" . "1,00" + "1,99" . "<br/>\n");

/* If you uncomment this, parse error occurs
$x = 2,99;
$y = 3,27;
print($x+$y);
*/

Expected result:
----------------
Freitag 22 Dezember 1978
Array
(
    [decimal_point] => ,
    [thousands_sep] => .
    [int_curr_symbol] => EUR 
    [currency_symbol] => ?
    [mon_decimal_point] => ,
    [mon_thousands_sep] => .
    [positive_sign] => 
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 0
    [p_sep_by_space] => 1
    [n_cs_precedes] => 0
    [n_sep_by_space] => 1
    [p_sign_posn] => 1
    [n_sign_posn] => 1
    [grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)

2,99

6,26 


Actual result:
--------------
Freitag 22 Dezember 1978
Array
(
    [decimal_point] => ,
    [thousands_sep] => .
    [int_curr_symbol] => EUR 
    [currency_symbol] => ?
    [mon_decimal_point] => ,
    [mon_thousands_sep] => .
    [positive_sign] => 
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 0
    [p_sep_by_space] => 1
    [n_cs_precedes] => 0
    [n_sep_by_space] => 1
    [p_sign_posn] => 1
    [n_sign_posn] => 1
    [grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)

2

5 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-28 17:35 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.
 [2005-04-28 17:56 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is actually the intended behaviours, PHP only uses the "." for as the decimal separators regardless of the locale.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 00:01:28 2024 UTC