Bug #53667 [NEW]: number_format problem in empty string
| From: | diego at agudo dot eti dot br | Date: | Thu, 06 Jan 2011 11:59:25 +0000 |
| Subject: | Bug #53667 [NEW]: number_format problem in empty string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-157663@lists.php.net to get a copy of this message | ||
From:
Operating system: Debian-5
PHP version: 5.3.4
Package: *Math Functions
Bug Type: Bug
Bug description:number_format problem in empty string
Description:
------------
The problem occurs in version 5.3.4, the same situation does not create
problems in version 5.2.6.
Passing an empty string as a parameter is generated an error that the
parameter must be of type double the problem does not occur if the same
string is not empty.
Test script:
---------------
Example 01:
Code:
<?
$x = "";
echo "-->". number_format($x);
?>
Output:
Warning: number_format() expects parameter 1 to be double, string given in
/www/htdocs/test.php on line 5
-->
Example 02:
<?
$x = "0";
echo "-->". number_format($x);
?>
Output:
-->0
Expected result:
----------------
I hope the developers look fondly and fix this problem. Although trivial,
many other applications users can also get this problem.
--
Edit bug report at http://bugs.php.net/bug.php?id=53667&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53667&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53667&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53667&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53667&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53667&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53667&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53667&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53667&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53667&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53667&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53667&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53667&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53667&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53667&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53667&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53667&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53667&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53667&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53667&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53667&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53667&r=mysqlcfg