#28738 [Opn]: printf formatting bug
| From: | mark at islandnet dot com | Date: | Fri, 11 Jun 2004 04:07:07 +0000 |
| Subject: | #28738 [Opn]: printf formatting bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60762@lists.php.net to get a copy of this message | ||
ID: 28738
User updated by: mark at islandnet dot com
Reported By: mark at islandnet dot com
Status: Open
Bug Type: *General Issues
Operating System: FreeBSD 4.10
PHP Version: 4.3.7
New Comment:
Confirmed that this bug was not in 4.3.6 or 4.3.4 (the only other
versions I have handy).
Also, I have it backwards. The first line (zero.something) is correct,
it's the second line of output that is missing 4 spaces. Previous
versions of PHP output both lines with the same spacing as the second
line of this example.
Previous Comments:
------------------------------------------------------------------------
[2004-06-11 06:05:32] mark at islandnet dot com
.
------------------------------------------------------------------------
[2004-06-11 05:46:10] mark at islandnet dot com
Description:
------------
Width formatting of %f values is buggy when the value is zero point
something.
Reproduce code:
---------------
<?
printf( "[%10.3f]\n", 0.5 );
printf( "[%10.3f]\n", 1.5 );
?>
Expected result:
----------------
[ 0.500]
[ 1.500]
That is: same overall width for both is expected.
Actual result:
--------------
[ 0.500]
[ 1.500]
Note the 4 extra spaces in the first line!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28738&edit=1