|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-13 05:44 UTC] abies@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
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