php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27743 mssql_fetch_object with float
Submitted: 2004-03-29 00:46 UTC Modified: 2004-03-29 13:24 UTC
From: pixyteam at netscape dot net Assigned: fmk
Status: Closed Package: MSSQL related
PHP Version: 4.3.5 OS: Windows 2000 Server
Private report: No CVE-ID:
 [2004-03-29 00:46 UTC] pixyteam at netscape dot net
Description:
------------
a float value in DB is 3.6000
with PHP 4.3.4 is work O.K.
with PHP 4.3.5 isn't.

Reproduce code:
---------------
ex1:
$sql = "SELECT cost FROM buy WHERE buyid '20040329000001'";
$qid = mssql_query($sql,$lid);
$a   = mssql_fetch_object($qid);
echo sprintf("%.2f",$a->cost);
exit();

ex2:
change $sql is ok.
$sql = "SELECT CONVERT(varchar,cost) AS cost FROM buy WHERE buyid '20040329000001'";
other lines same as ex1.


Expected result:
----------------
ex1:
in 4.3.4 -> 3.60
in 4.3.5 -> 3.60

ex2:
in 4.3.4 -> 3.60
in 4.3.5 -> 3.60


Actual result:
--------------
ex1.
in 4.3.4 -> 3.60
in 4.3.5 -> 5.04467447157E-041

ex2.
in 4.3.4 -> 3.60
in 4.3.5 -> 3.60



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-29 13:24 UTC] fmk@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 00:02:04 2014 UTC