|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78056 Wrong currency format for nl_BE with money_format
Submitted: 2019-05-23 14:09 UTC Modified: 2019-05-23 15:04 UTC
From: wesley at weha dot be Assigned:
Status: Not a bug Package: Strings related
PHP Version: 7.3.5 OS: Centos 7.6
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.
Bug Type:
From: wesley at weha dot be
New email:
PHP Version: OS:


 [2019-05-23 14:09 UTC] wesley at weha dot be
When I use nl_BE locale I get the wrong format for negative values.
-1234.56 should be € -1 234,56
money_format gives this: € 1 234,56-

I'm sorry if anything is filled in wrong, first time here.

thank you.

Test script:
setlocale(LC_ALL, 'nl_BE.UTF-8')
echo money_format('%.2n','-1234.56');

Expected result:
€ -1 234,56

Actual result:
€ 1 234,56-


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-23 14:25 UTC]
-Summary: Wrong currency format for nl_BE +Summary: Wrong currency format for nl_BE with money_format -Status: Open +Status: Not a bug -Package: Unknown/Other Function +Package: Strings related
 [2019-05-23 14:25 UTC]
The output of money_format is controlled by your system's strfmon(3) function, not PHP.

Looks like your locale settings are way out of date: CLDR 26 (the relevant standard for this stuff) is the last time the NL locale was set to use the "¤ #,##0.00-" format, and CLDR 27 changed it to "¤ -#,##0.00" - that was back in 2015.

Update your system and/or locale settings.
 [2019-05-23 14:45 UTC]
I actually have the exact same output on my completely up-to-date machine. It seems this is controlled by glibc, and I have 2.29-1 installed which is the latest version.

I can confirm requinix's observation (looking at)

However, nl_BE LC_MONETARY is an alias to nl_NL and /usr/share/i18n/locales/nl_NL has n_sign_posn=2 - which according to means: print minus sign after number.

So this might be a glibc bug?
 [2019-05-23 15:04 UTC]
Oh yes, forgot glibc does locale its own way...

Yup, looking at the glibc source;a=tree;f=localedata/locales;hb=refs/heads/master
they have nl_BE copying from nl_NL which has n_sign_pos=2.

So it's an upstream bug.
 [2019-05-23 15:07 UTC]
I've reported this to glibc as
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 09:01:29 2024 UTC