Hi, Here's patches I mentioned a week ago for bug #29538. I happened to notice it while trying to enhance the functionality of number_format(). It's also mentioned at the end of bug #28228. Where
number_format(1234, 2, '', ',') returns 123,400 instead of the expected 1,23400 Happens when decimal places is > 0 with an empty decimal separator. There's a test with that criteria, but the thousands separator is also empty, which hides the bug. I also made some small optimizations -- removing a strlen(), etc. -- hope they're OK. Another possible(?) problem in _php_math_number_format was that if no decimal point was found (with dec > 0), s-- would lose the right-most integer digit. That's why it's decremented in the if (dp) { } block now. (dp should exist, I guess, if dec > 0, but the check is already there in case. :-)) Finally, I changed the proto, if that's OK, to match what's in the manual, and be closer to the variable names... And "separator" was spelled wrong anyway. ;-) I don't know if it's too late to fix 4.4.3, but I have the diff for it too. http://realplain.com/php/number_format_bug29538.diff http://realplain.com/php/number_format_bug29538_5_2.diff http://realplain.com/php/number_format_bug29538_4_4.diff And a test file: http://realplain.com/php/bug29538.phpt Thanks, Matt -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php