Red Hat Bugzilla – Bug 203378
PHP *printf() %f formatting problems
Last modified: 2007-11-30 17:07:10 EST
Description of problem:
printf() float formatting is incorrect.
This is fixed in php 4.3.7 The PHP changelog for 4.3.7 didn't list any apparent
fixed bugs that would correct this, but had this comment:
Fixed problems with *printf() functions and '%f' formatting. (Marcus)
Thanks for the report. Unfortunately to fix this would be an interface change
which would result in output changes to sites which rely on the current
behaviour, so is not a change which could be made in a RHEL update.
In case it's not clear, the 4.3.2 behaviour was to count only the length of the
integer part towards the field width; so the workaround is to use a field width
specifier N smaller than desired where N is equal to precision + 1 (1 for the
radix). It is appreciated that it is awkward to use such a workaround for PHP
code designed to be portable across multiple versions of PHP.