mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Fixed bug #28633 (sprintf incorrectly adding padding to floats).
This commit is contained in:
parent
1ea073fb7a
commit
8840191d91
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
"
|
||||
|
10
ext/standard/tests/strings/bug28633.phpt
Normal file
10
ext/standard/tests/strings/bug28633.phpt
Normal 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
|
Loading…
Reference in New Issue
Block a user