php.net |  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
 [2005-02-07 22:11 UTC] kalle at ok dot ee
Description:
------------
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"



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC