ID: 28633
User updated by: jschmidt at thriftycmh dot net
Reported By: jschmidt at thriftycmh dot net
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Linux 2.4
PHP Version: 4.3.7
New Comment:
How can this be correct behavior if it was working this way for all the
previous 4.3.X versions? I did check the manual and I see no updates
to indicate that this is changed behavior. In fact, quoting from the
manual:
http://www.php.net/manual/en/function.sprintf.php
"Each conversion specification consists of a percent sign (%), followed
by one or more of these elements, in order:
An optional padding specifier that says what character will be used for
padding the results to the right string size. This may be a space
character or a 0 (zero character). The default is to pad with spaces"
So again, sprintf("%3.2f",'1.00') is no longer padding with leading
spaces as it was in previous versions. If it is a changed behavior,
please indicate this in the documentation.
Previous Comments:
------------------------------------------------------------------------
[2004-06-04 17:21:44] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is the correct behaviour.
------------------------------------------------------------------------
[2004-06-04 17:12:58] jschmidt at thriftycmh dot net
Description:
------------
sprintf("%3.2f",'1.00')
This was working fine in 4.3.6 but not in 4.3.7. The expected output
is " 1.00" but is "1.00". In other words, the leading spaces are no
longer working.
Reproduce code:
---------------
sprintf("%3.2f",'1.00')
Expected result:
----------------
" 1.00"
Actual result:
--------------
"1.00"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28633&edit=1