is_negative = 1;
d = -d;
}
- dec = MAX(0, dec);
+ if (!dec_point && dec > 0) {
+ d *= pow(10, dec);
+ dec = 0;
+ } else {
+ dec = MAX(0, dec);
+ }
PHP_ROUND_WITH_FUZZ(d, dec);
convert_to_string_ex(t_s);
if (Z_STRLEN_PP(d_p)==1) {
dec_point=Z_STRVAL_PP(d_p)[0];
+ } else if (Z_STRLEN_PP(d_p)==0) {
+ dec_point=0;
}
if (Z_STRLEN_PP(t_s)==1) {
thousand_sep=Z_STRVAL_PP(t_s)[0];
--- /dev/null
+--TEST--
+Bug #28228 (number_format() does not allow empty decimal separator)
+--FILE--
+<?php
+echo number_format(1234.5678, 4, '', '') . "\n";
+echo number_format(1234.5678, 4, NULL, ',') . "\n";
+echo number_format(1234.5678, 4, 0, ',') . "\n";
+echo number_format(1234.5678, 4);
+?>
+--EXPECT--
+12345678
+12,345,678
+1,23405678
+1,234.5678