Fixed bug #28633 (sprintf incorrectly adding padding to floats).

This commit is contained in:
Ilia Alshanetsky 2004-07-18 17:27:49 +00:00
parent 1ea073fb7a
commit 8840191d91
3 changed files with 11 additions and 4 deletions

View File

@ -398,9 +398,6 @@ php_sprintf_appenddouble(char **buffer, int *pos,
numbuf[i] = '\0';
if (precision > 0) {
width += (precision + 1);
}
php_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding,
alignment, i, sign, 0, always_sign);
}

View File

@ -7,5 +7,5 @@ Bug #22207 (missing 0 when using the e notation in *printf functions)
?>
--EXPECT--
1.1000e+0
string(17) " 1.1000e+0
string(11) " 1.1000e+0
"

View File

@ -0,0 +1,10 @@
--TEST--
Bug #28633 (sprintf incorrectly adding padding to floats)
--FILE--
<?php
echo sprintf("%05.2f", 0.02) . "\n";
echo sprintf("%05.2f", 2.02) . "\n";
?>
--EXPECT--
00.02
02.02