#27235 [Opn->Csd]: NUMERIC x.0 field returns empty string on 0
| From: | abies@php.net | Date: | Fri, 13 Feb 2004 10:44:45 +0000 |
| Subject: | #27235 [Opn->Csd]: NUMERIC x.0 field returns empty string on 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-54844@lists.php.net to get a copy of this message | ||
ID: 27235
Updated by: abies@php.net
Reported By: pfournier at loups dot net
-Status: Open
+Status: Closed
Bug Type: InterBase related
Operating System: Linux
PHP Version: 4.3.4
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2004-02-12 19:39:03] pfournier at loups dot net
Description:
------------
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);
print("'$obj->NUMERIC_FIELD'");
Expected result:
----------------
'0' should be printed
Actual result:
--------------
'' is printed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27235&edit=1