Eileen, thanks for your comment here and in the code. I've been wrestling with this for a bit because it seems to be causing intermittent issues on some of our sites, and I can confirm that at least in my testing, during the money format call, there is no locale defined, and so the money_format function will sometimes generate round brackets instead of a negative sign. I considered trying to fix the format function when called with the "only number" parameter set to true, but it'd be difficult to figure out all the places that might be used that could be broken if I changed it. As far as I can tell, the "only number" option seems to just be a way to remove the currency symbol, so that may be called with or without any locale-expectations.
So I think the way to fix this is either:
- by replacing the patch from this issue with one that is simpler and locale-agnostic (i.e. a simple format that ensures 2 digits).
- revert the patch and let paypal and/or other payment processors handle the formatting if still necessary.
My reading of the original issue is that it was solving a problem that could better be handled in the payment processor code, since each processor has different requirements of what format the money coming in requires. Actually, Karin thinks that Paypal will now handle amounts with arbitrary numbers of digits.
Additionally, rounding to two digits at this stage is also a potential problem if taxes are going to be applied later on in the code, as per some upcoming work from Matt.
Conclusion: I'm leaning strongly towards option 2., feedback encouraged. I'll create a new issue if anyone bites.
Submitted PR at https://github.com/civicrm/civicrm-core/pull/5767