|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27235 NUMERIC x.0 field returns empty string on 0
Submitted: 2004-02-12 19:39 UTC Modified: 2004-02-13 05:44 UTC
From: pfournier at loups dot net Assigned:
Status: Closed Package: InterBase related
PHP Version: 4.3.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pfournier at loups dot net
New email:
PHP Version: OS:


 [2004-02-12 19:39 UTC] pfournier at loups dot net
When a NUMERIC or DECIMAL field with precision of 0 has a value of 0, when fetching data, an empty string is returned instead of zero.

According to CVS, it's still in the latest PHP4 version, but  the code has been changed in PHP5.

Here's the patch:

--- interbase.c.orig    2004-02-12 19:09:30.000000000 -0500
+++ interbase.c 2004-02-12 19:10:18.000000000 -0500
@@ -1856,7 +1856,7 @@
                                                                               "-0", -scale, (ISC_INT64) -(n % f) );
                        } else {
-                               Z_STRLEN_P(val) =sprintf (string_data, "%.0" ISC_INT64_FORMAT "d",
+                               Z_STRLEN_P(val) =sprintf (string_data, "%" ISC_INT64_FORMAT "d",
                                                                                            (ISC_INT64) *(ISC_INT64 *) data);


Reproduce code:
[Connect to database, then:]
  $query = "SELECT numeric_field FROM test_table WHERE numeric_field = 0";
  $rs = ibase_query($linkID, $query);
  $obj = ibase_fetch_object($rs);

Expected result:
'0' should be printed

Actual result:
'' is printed


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-13 05:44 UTC]
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
Thank you for the report, and for helping us make PHP better.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 09:01:41 2024 UTC