|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31877 PRINTF returns garbage
Submitted: 2005-02-07 22:11 UTC Modified: 2005-02-08 07:49 UTC
From: kalle at ok dot ee Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.10 OS: linux 2.4.28
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 - 22 = ?
Subscribe to this entry?

 [2005-02-07 22:11 UTC] kalle at ok dot ee
new installation (server, apache, PHP). apache 1.3.33, PHP 4.3.10, slackware current.
in previous server there were no problems. but now PRINTF returns total garbage:
for example:
<?=PRINTF("%.2f", (10/4));?> returns "2.504"
<?=PRINTF("%.2f", 10.00);?> returns "10.005"
<?=PRINTF("%.2f", 10);?> returns "10.005"
<?=PRINTF("%.2f", 125.00);?> returns "125.006"

disabled all Zend extension and googled a long time. no solution for me. dev team? any ideas?

thanks in advance!

Reproduce code:
<?=PRINTF("%.2f", (10/4));?> returns "2.504"
<?=PRINTF("%.2f", 10.00);?> returns "10.005"
<?=PRINTF("%.2f", 10);?> returns "10.005"
<?=PRINTF("%.2f", 125.00);?> returns "125.006"

Expected result:
<?=PRINTF("%.2f", (10/4));?> returns "2.50"
<?=PRINTF("%.2f", 10.00);?> returns "10.00"
<?=PRINTF("%.2f", 10);?> returns "10.00"
<?=PRINTF("%.2f", 125.00);?> returns "125.00"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-08 07:49 UTC] kalle at ok dot ee
I have to admit, that I was stupid :(

In previous versions PRINTF() returned true/false or nothing. From some versions on it returns number of characters printed. And <?=PRINTF();?> is not right, <?PRINTF();?> or <?=SPRINTF();?> is.

Sorry everyone. But that return string was confusing :)

Conclusion - overworking makes deamons appear..
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 06:03:57 2023 UTC